diff options
-rw-r--r-- | bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java index eb0dd8d2739..4f249269fc8 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java @@ -420,6 +420,8 @@ public final class Workbench extends EventManager implements IWorkbench { boolean initializationDone = false; + private WorkbenchWindow windowBeingCreated = null; + /** * Creates a new workbench. * @@ -1223,19 +1225,24 @@ public final class Workbench extends EventManager implements IWorkbench { WorkbenchWindow result = (WorkbenchWindow) windowContext.get(IWorkbenchWindow.class .getName()); if (result == null) { + if (windowBeingCreated != null) + return windowBeingCreated; result = new WorkbenchWindow(input, descriptor); - - if (newWindow) { - Point size = result.getWindowConfigurer().getInitialSize(); - window.setWidth(size.x); - window.setHeight(size.y); - application.getChildren().add(window); - application.setSelectedElement(window); + windowBeingCreated = result; + try { + if (newWindow) { + Point size = result.getWindowConfigurer().getInitialSize(); + window.setWidth(size.x); + window.setHeight(size.y); + application.getChildren().add(window); + application.setSelectedElement(window); + } + ContextInjectionFactory.inject(result, windowContext); + windowContext.set(IWorkbenchWindow.class.getName(), result); + } finally { + windowBeingCreated = null; } - ContextInjectionFactory.inject(result, windowContext); - windowContext.set(IWorkbenchWindow.class.getName(), result); - if (application.getSelectedElement() == window) { application.getContext().set(ISources.ACTIVE_WORKBENCH_WINDOW_NAME, result); application.getContext().set(ISources.ACTIVE_WORKBENCH_WINDOW_SHELL_NAME, result.getShell()); |