diff options
author | Remy Suen | 2011-07-20 13:14:30 +0000 |
---|---|---|
committer | Paul Webster | 2011-08-25 14:21:55 +0000 |
commit | 23ccb7b44a57705ba20217eaed9c4f502efc07be (patch) | |
tree | 3c74e101fdbd37f26977f2715a75b8e687f88bcb | |
parent | 95750d7e16ba1fb2b1950c8e1b323ce955f684fa (diff) | |
download | eclipse.platform.ui-23ccb7b44a57705ba20217eaed9c4f502efc07be.tar.gz eclipse.platform.ui-23ccb7b44a57705ba20217eaed9c4f502efc07be.tar.xz eclipse.platform.ui-23ccb7b44a57705ba20217eaed9c4f502efc07be.zip |
Bug 352508 [Compatibility] Closing active perspective should set the
window to the last active perspective
The code was originally just closing the perspective and if it was
the active perspective, the model service would set the selected
element of the perspective stack to the first available perspective
in its list. Instead of this arbitrary selection, the window should
instead be selecting the previously active perspective. The fix is
to update the perspective stack's selected element prior to letting
the model service close the perspective.
-rw-r--r-- | bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java index 988c4818a3e..54b3286f684 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java @@ -1358,6 +1358,16 @@ public class WorkbenchPage extends CompatibleWorkbenchPage implements // Remove from caches sortedPerspectives.remove(desc); + // check if we're closing the currently active perspective + if (getPerspectiveStack().getSelectedElement() == persp + && !sortedPerspectives.isEmpty()) { + // get the perspective that was last active and set it + IPerspectiveDescriptor lastActive = sortedPerspectives.get(sortedPerspectives + .size() - 1); + if (lastActive != null) { + setPerspective(lastActive); + } + } modelService.removePerspectiveModel(persp, window); } } |