Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Moffatt2014-08-20 18:50:13 +0000
committerWojciech Sudol2014-09-01 12:13:55 +0000
commit1e7d896ac714b1cc4895d2098c715334b09843e2 (patch)
treef3198a7036df75ff72bf8eb7f672db99cde92244
parentbee9a95d7b21624f8a7d95c4601acfeb55ad7998 (diff)
downloadeclipse.platform.ui-1e7d896ac714b1cc4895d2098c715334b09843e2.tar.gz
eclipse.platform.ui-1e7d896ac714b1cc4895d2098c715334b09843e2.tar.xz
eclipse.platform.ui-1e7d896ac714b1cc4895d2098c715334b09843e2.zip
Bug 430403 - [Perspectives] Views without sash to resize and complete
loss of views
-rw-r--r--bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/PartServiceImpl.java26
1 files changed, 17 insertions, 9 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 8a74ea87a82..390e1b2e6a1 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
@@ -42,6 +42,8 @@ import org.eclipse.e4.ui.model.application.ui.advanced.MPlaceholder;
import org.eclipse.e4.ui.model.application.ui.basic.MCompositePart;
import org.eclipse.e4.ui.model.application.ui.basic.MInputPart;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.basic.MPartSashContainer;
+import org.eclipse.e4.ui.model.application.ui.basic.MPartSashContainerElement;
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
import org.eclipse.e4.ui.model.application.ui.basic.MStackElement;
import org.eclipse.e4.ui.model.application.ui.basic.MWindow;
@@ -973,16 +975,22 @@ public class PartServiceImpl implements EPartService {
}
MElementContainer<?> lastContainer = getLastContainer(searchRoot, children);
- if (lastContainer == null) {
- MPartStack stack = modelService.createModelElement(MPartStack.class);
- searchRoot.getChildren().add(stack);
- return stack;
- } else if (!(lastContainer instanceof MPartStack)) {
- MPartStack stack = modelService.createModelElement(MPartStack.class);
- ((List) lastContainer.getChildren()).add(stack);
- return stack;
+ if (lastContainer instanceof MPartStack) {
+ return lastContainer;
+ }
+
+ // No stacks found make one and add it
+ MPartStack stack = modelService.createModelElement(MPartStack.class);
+ stack.setElementId("CreatedByGetLastContainer"); //$NON-NLS-1$
+ if (children.get(0) instanceof MPartSashContainer) {
+ MPartSashContainer psc = (MPartSashContainer) children.get(0);
+ psc.getChildren().add(stack);
+ } else {
+ // We need a sash so 'insert' the new stack
+ modelService.insert(stack, (MPartSashContainerElement) children.get(0),
+ EModelService.RIGHT_OF, 0.5f);
}
- return lastContainer;
+ return stack;
}
private MElementContainer<?> getLastContainer(MElementContainer<?> container, List<?> children) {

Back to the top