debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/status/ConnectionStatusReconciler.java
changeset 961 8c95e3acb374
parent 924 657e34ac671f
child 962 239e8d35ac54
--- a/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/status/ConnectionStatusReconciler.java	Mon Feb 15 14:48:52 2010 -0600
+++ b/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/status/ConnectionStatusReconciler.java	Tue Feb 16 09:29:07 2010 -0600
@@ -131,26 +131,27 @@
 
 	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() {
-				public void run() {
-					// try to show the connections view to start service testers
-					try {
-						WorkbenchUtils.getView(CONNECTIONS_VIEW_ID);
-					} catch (PartInitException e) {
-					}
+		final Shell shell = WorkbenchUtils.getActiveShell();
+		final boolean isVisible[] = { true };
+		Display.getDefault().syncExec(new Runnable() {
+			public void run() {
+				isVisible[0] = shell != null && shell.isVisible();
+			}
+		});
+		
+		Runnable runnable = new Runnable() {
+			public void run() {
+				try {
+					WorkbenchUtils.getView(CONNECTIONS_VIEW_ID);
+				} catch (PartInitException e) {
 				}
-			});
+			}
+		};
+		
+		if (shell == null || !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);
 		}
 	}