Fix bug 10725 -- jam more UI code into syncExec RCL_2_4
authordadubrow
Wed, 17 Feb 2010 08:25:29 -0600
branchRCL_2_4
changeset 973 bd54fb1ea34a
parent 968 bff887fe7694
child 976 e3db0fe33733
child 977 787669693166
Fix bug 10725 -- jam more UI code into syncExec
debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/status/ConnectionStatusReconciler.java
--- a/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/status/ConnectionStatusReconciler.java	Tue Feb 16 13:44:12 2010 -0600
+++ b/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/status/ConnectionStatusReconciler.java	Wed Feb 17 08:25:29 2010 -0600
@@ -130,27 +130,32 @@
 	}
 
 	private void showConnectionsView() {
-		// avoid deadlock if this called as a result of a launch sequence issuing a "select connection" dialog
-		Shell shell = WorkbenchUtils.getActiveShell();
-		if (shell == null || !shell.isVisible()) {
-			RunRunnableWhenWorkbenchVisibleJob.start(new Runnable() {
+		// avoid deadlock with RunRunnableWhenWorkbenchVisibleJob 
+		// if this called as a result of a launch sequence issuing a "select connection" dialog
+		final Shell shell = WorkbenchUtils.getActiveShell();
+		final boolean isVisible[] = { false };
+		
+		if (shell != null) {
+			Display.getDefault().syncExec(new Runnable() {
 				public void run() {
-					// try to show the connections view to start service testers
-					try {
-						WorkbenchUtils.getView(CONNECTIONS_VIEW_ID);
-					} catch (PartInitException e) {
-					}
+					isVisible[0] = shell.isVisible();
 				}
 			});
+		}
+		
+		Runnable runnable = new Runnable() {
+			public void run() {
+				try {
+					WorkbenchUtils.getView(CONNECTIONS_VIEW_ID);
+				} catch (PartInitException e) {
+				}
+			}
+		};
+		
+		if (!isVisible[0]) {
+			RunRunnableWhenWorkbenchVisibleJob.start(runnable);
 		} else {
-			Display.getDefault().asyncExec(new Runnable() {
-				public void run() {
-					try {
-						WorkbenchUtils.getView(CONNECTIONS_VIEW_ID);
-					} catch (PartInitException e) {
-					}
-				}
-			});
+			Display.getDefault().asyncExec(runnable);
 		}
 	}