Fix bug 10725 -- jam more UI code into syncExec
authorEd Swartz <ed.swartz@nokia.com>
Tue, 16 Feb 2010 09:32:37 -0600
changeset 962 239e8d35ac54
parent 961 8c95e3acb374
child 964 b0c1a1239188
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 09:29:07 2010 -0600
+++ b/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/status/ConnectionStatusReconciler.java	Tue Feb 16 09:32:37 2010 -0600
@@ -130,14 +130,18 @@
 	}
 
 	private void showConnectionsView() {
-		// avoid deadlock if this called as a result of a launch sequence issuing a "select connection" dialog
+		// 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[] = { true };
-		Display.getDefault().syncExec(new Runnable() {
-			public void run() {
-				isVisible[0] = shell != null && shell.isVisible();
-			}
-		});
+		final boolean isVisible[] = { false };
+		
+		if (shell != null) {
+			Display.getDefault().syncExec(new Runnable() {
+				public void run() {
+					isVisible[0] = shell.isVisible();
+				}
+			});
+		}
 		
 		Runnable runnable = new Runnable() {
 			public void run() {
@@ -148,7 +152,7 @@
 			}
 		};
 		
-		if (shell == null || !isVisible[0]) {
+		if (!isVisible[0]) {
 			RunRunnableWhenWorkbenchVisibleJob.start(runnable);
 		} else {
 			Display.getDefault().asyncExec(runnable);