Run create global prefs tests asynch on UI thread
authortimkelly
Wed, 13 Oct 2010 12:30:28 -0500
changeset 2152 816abb894472
parent 2151 fab48956482f
child 2153 dc389613cff5
child 2157 90c82caa6918
Run create global prefs tests asynch on UI thread
builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestCreateGlobalPrefs.java
--- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestCreateGlobalPrefs.java	Wed Oct 13 11:00:18 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestCreateGlobalPrefs.java	Wed Oct 13 12:30:28 2010 -0500
@@ -17,6 +17,7 @@
 */
 package com.nokia.carbide.cdt.builder.test;
 
+import org.eclipse.swt.widgets.Display;
 import org.eclipse.ui.dialogs.PreferencesUtil;
 
 import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils;
@@ -27,6 +28,9 @@
  */
 public class TestCreateGlobalPrefs extends BaseTest {
 	
+	// Deprecated - are filtered
+	//com.nokia.cdt.debug.cw.symbian.ui.GlobalSettings
+	//com.nokia.carbide.cpp.logging.LoggingPreferencesPage
 	private static final String[] carbidePrefIds = { "com.nokia.carbide.cpp.sdk.ui.preferences.BuildPlatformFilterPage",
 		"com.nokia.carbide.cpp.internal.sdk.ui.SDKPreferencePage",
 		"com.nokia.carbide.cpp.internal.sdk.ui.SDKPreferencePage",
@@ -57,12 +61,23 @@
 	 */
 	public void testCreatePrefs() throws Exception {
 		
-		for (String id : carbidePrefIds){
-			PreferencesUtil.createPreferenceDialogOn(WorkbenchUtils.getSafeShell(), id, null, null, 0);
-		}
+//		make sure to run on UI thread
+//		Display getAsynch()
+//		capture and throw exception
+//		wait to finish before existing
+		
+		// TODO: Need to throw exception on error when loading a pref page
 		
-		// Deprecated - to be filtered
-		//com.nokia.cdt.debug.cw.symbian.ui.GlobalSettings
-		//com.nokia.carbide.cpp.logging.LoggingPreferencesPage
+		Display.getDefault().asyncExec(new Runnable() {
+
+			@Override
+			public void run() {
+				for (String id : carbidePrefIds){
+					PreferencesUtil.createPreferenceDialogOn(WorkbenchUtils.getSafeShell(), id, null, null, 0);
+				}
+			}
+			
+		});
+		
 	}
 }