diff options
-rw-r--r-- | bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java index 99d737836..1adcdb3ed 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java @@ -290,15 +290,21 @@ public class Utils { } public static Shell findShell() { - IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); - if(window != null) { - return window.getShell(); - } + // First find the active shell of the display and use it. + // We need to do this since the active shell may be model + // in which case we nned to parent off that or risk deadlock Display display= Display.getCurrent(); if (display == null) { display= Display.getDefault(); + } + if (display != null) { return display.getActiveShell(); } + // Try to use the active window (although I suspect this will fail if the bove failed) + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + if(window != null) { + return window.getShell(); + } // worst case, just create our own. return new Shell(TeamUIPlugin.getStandardDisplay()); } |