summaryrefslogtreecommitdiffstats
authorEric Moffatt2012-05-03 16:03:52 (EDT)
committer Eric Moffatt2012-05-03 16:03:52 (EDT)
commit5a8bcce23595f552332831e75ff921a185623eef (patch) (side-by-side diff)
treec863ce85300e71044b4a4216fb8f8b10d55d89e6
parentf7f82921fb3ca7ebd3b2b537350ca05d783de215 (diff)
downloadeclipse.platform.ui-5a8bcce23595f552332831e75ff921a185623eef.zip
eclipse.platform.ui-5a8bcce23595f552332831e75ff921a185623eef.tar.gz
eclipse.platform.ui-5a8bcce23595f552332831e75ff921a185623eef.tar.bz2
Fix for Bug 378330 - Closing a perspective first creates all partsv20120503-2003I20120503-1800
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/PartServiceImpl.java50
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java17
2 files changed, 38 insertions, 29 deletions
diff --git a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/PartServiceImpl.java b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/PartServiceImpl.java
index 2c2bba4..1626981 100644
--- a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/PartServiceImpl.java
+++ b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/PartServiceImpl.java
@@ -980,7 +980,7 @@ public class PartServiceImpl implements EPartService {
element.setToBeRendered(true);
element = placeholder;
}
-
+
// render this element
element.setToBeRendered(true);
@@ -1057,33 +1057,37 @@ public class PartServiceImpl implements EPartService {
part);
}
- if (parent.getSelectedElement() == toBeRemoved) {
- // if we're the selected element and we're going to be hidden, need to select
- // something else
- MUIElement candidate = partActivationHistory.getSiblingSelectionCandidate(part);
- candidate = candidate == null ? null
- : candidate.getCurSharedRef() == null ? candidate : candidate
- .getCurSharedRef();
- if (candidate != null && children.contains(candidate)) {
- parent.setSelectedElement(candidate);
- } else {
- for (MUIElement child : children) {
- if (child != toBeRemoved && child.isToBeRendered()) {
- parent.setSelectedElement(child);
- break;
+ MPerspective thePersp = modelService.getPerspectiveFor(toBeRemoved);
+ boolean needNewSel = thePersp == null || !thePersp.getTags().contains("PerspClosing"); //$NON-NLS-1$
+ if (needNewSel) {
+ if (parent.getSelectedElement() == toBeRemoved) {
+ // if we're the selected element and we're going to be hidden, need to select
+ // something else
+ MUIElement candidate = partActivationHistory.getSiblingSelectionCandidate(part);
+ candidate = candidate == null ? null
+ : candidate.getCurSharedRef() == null ? candidate : candidate
+ .getCurSharedRef();
+ if (candidate != null && children.contains(candidate)) {
+ parent.setSelectedElement(candidate);
+ } else {
+ for (MUIElement child : children) {
+ if (child != toBeRemoved && child.isToBeRendered()) {
+ parent.setSelectedElement(child);
+ break;
+ }
}
}
}
- }
- if (activationCandidate == null) {
- // nothing else to activate and we're the active child, deactivate
- if (isActiveChild) {
- part.getContext().deactivate();
+ if (activationCandidate == null) {
+ // nothing else to activate and we're the active child, deactivate
+ if (isActiveChild) {
+ part.getContext().deactivate();
+ }
+ } else {
+ // activate our candidate
+ activate(activationCandidate);
}
- } else {
- // activate our candidate
- activate(activationCandidate);
}
if (toBeRemoved != null) {
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 d53e7d7..20a447e 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
@@ -1655,12 +1655,17 @@ public class WorkbenchPage extends CompatibleWorkbenchPage implements
MPerspective persp = (MPerspective) modelService.find(perspectiveId, window);
// check to ensure this perspective actually exists in this window
if (persp != null) {
- MPerspectiveStack perspectiveStack = modelService.findElements(window, null,
- MPerspectiveStack.class, null).get(0);
- if (perspectiveStack.getChildren().size() == 1) {
- closeAllPerspectives(saveParts, closePage);
- } else {
- closePerspective(desc, perspectiveId, saveParts);
+ persp.getTags().add("PerspClosing"); //$NON-NLS-1$
+ try {
+ MPerspectiveStack perspectiveStack = modelService.findElements(window, null,
+ MPerspectiveStack.class, null).get(0);
+ if (perspectiveStack.getChildren().size() == 1) {
+ closeAllPerspectives(saveParts, closePage);
+ } else {
+ closePerspective(desc, perspectiveId, saveParts);
+ }
+ } finally {
+ persp.getTags().remove("PerspClosing"); //$NON-NLS-1$
}
}
}