diff options
author | Remy Suen | 2011-09-07 12:42:16 +0000 |
---|---|---|
committer | Remy Suen | 2011-09-07 12:42:16 +0000 |
commit | 8d62f6eec83a9295ab5af5ffa2eaf4e5199c9841 (patch) | |
tree | 15fc89e746c3afe5ae1b84c22f54c29fa974a69e /bundles/org.eclipse.e4.ui.workbench | |
parent | 421f03940c92071934ab7de519d25bf335dc108c (diff) | |
download | eclipse.platform.ui-8d62f6eec83a9295ab5af5ffa2eaf4e5199c9841.tar.gz eclipse.platform.ui-8d62f6eec83a9295ab5af5ffa2eaf4e5199c9841.tar.xz eclipse.platform.ui-8d62f6eec83a9295ab5af5ffa2eaf4e5199c9841.zip |
Bug 349331 [Compatibility] Closing non-active perspectives will removev20110907-1242
all views from the shared area
The code for closing a perspective was also removing
placeholders from the shared area. This code should only be
invoked when a perspective is reset.
Diffstat (limited to 'bundles/org.eclipse.e4.ui.workbench')
-rw-r--r-- | bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ModelServiceImpl.java | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ModelServiceImpl.java b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ModelServiceImpl.java index 634c6af400e..dc1b3a3f142 100644 --- a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ModelServiceImpl.java +++ b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ModelServiceImpl.java @@ -740,6 +740,11 @@ public class ModelServiceImpl implements EModelService { } public void resetPerspectiveModel(MPerspective persp, MWindow window) { + resetPerspectiveModel(persp, window, true); + } + + private void resetPerspectiveModel(MPerspective persp, MWindow window, + boolean removeSharedPlaceholders) { if (persp == null) return; @@ -749,24 +754,26 @@ public class ModelServiceImpl implements EModelService { } persp.getWindows().clear(); - // Remove any views (Placeholders) from the shared area - EPartService ps = window.getContext().get(EPartService.class); - List<MArea> areas = findElements(window, null, MArea.class, null); - if (areas.size() == 1) { - MArea area = areas.get(0); - - // Strip out the placeholders in visible stacks - List<MPlaceholder> phList = findElements(area, null, MPlaceholder.class, null); - for (MPlaceholder ph : phList) { - ps.hidePart((MPart) ph.getRef()); - ph.getParent().getChildren().remove(ph); - } + if (removeSharedPlaceholders) { + // Remove any views (Placeholders) from the shared area + EPartService ps = window.getContext().get(EPartService.class); + List<MArea> areas = findElements(window, null, MArea.class, null); + if (areas.size() == 1) { + MArea area = areas.get(0); + + // Strip out the placeholders in visible stacks + List<MPlaceholder> phList = findElements(area, null, MPlaceholder.class, null); + for (MPlaceholder ph : phList) { + ps.hidePart((MPart) ph.getRef()); + ph.getParent().getChildren().remove(ph); + } - // Prevent shared stacks ids from clashing with the ones in the perspective - List<MPartStack> stacks = findElements(area, null, MPartStack.class, null); - for (MPartStack stack : stacks) { - String generatedId = "PartStack@" + Integer.toHexString(stack.hashCode()); //$NON-NLS-1$ - stack.setElementId(generatedId); + // Prevent shared stacks ids from clashing with the ones in the perspective + List<MPartStack> stacks = findElements(area, null, MPartStack.class, null); + for (MPartStack stack : stacks) { + String generatedId = "PartStack@" + Integer.toHexString(stack.hashCode()); //$NON-NLS-1$ + stack.setElementId(generatedId); + } } } @@ -819,7 +826,7 @@ public class ModelServiceImpl implements EModelService { } // Remove transient elements (minimized stacks, detached windows) - resetPerspectiveModel(persp, window); + resetPerspectiveModel(persp, window, false); // unrender the perspective and remove it persp.setToBeRendered(false); |