summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorRemy Suen2011-08-22 14:41:13 (EDT)
committer Paul Webster2011-08-25 10:22:05 (EDT)
commit53e80f74fb7384191e67425d750789872d543f70 (patch)
tree9630f5b71b844965918b0f78aeff51de243d3041
parent9e12cfb2ca24556273a9f3ef52e97314ad4c812d (diff)
downloadeclipse.platform.ui-53e80f74fb7384191e67425d750789872d543f70.zip
eclipse.platform.ui-53e80f74fb7384191e67425d750789872d543f70.tar.gz
eclipse.platform.ui-53e80f74fb7384191e67425d750789872d543f70.tar.bz2
Bug 354739 [Compatibility] Perspectives with standalone views lay out
incorrectly When parts need to be placed relative to another part, the part's parent should be considered if it is a stack as the parts cannot be placed next to a part inside a part stack. However, if a part's parent is not a part stack then the part should just be placed relative to the part.
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartSite.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ModeledPageLayout.java27
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerService.java6
3 files changed, 24 insertions, 12 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartSite.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartSite.java
index 0b75185..965e682 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartSite.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartSite.java
@@ -224,7 +224,8 @@ public abstract class PartSite implements IWorkbenchPartSite {
* Initialize the local services.
*/
private void initializeDefaultServices() {
- IHandlerService handlerService = new LegacyHandlerService(e4Context);
+ IHandlerService handlerService = new LegacyHandlerService(e4Context,
+ new ActivePartExpression(part));
e4Context.set(IHandlerService.class.getName(), handlerService);
serviceLocator.registerService(IWorkbenchLocationService.class,
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ModeledPageLayout.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ModeledPageLayout.java
index a9e72a7..4749251 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ModeledPageLayout.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ModeledPageLayout.java
@@ -329,16 +329,6 @@ public class ModeledPageLayout implements IPageLayout {
private void insertView(String viewId, int relationship, float ratio,
String refId, boolean visible, boolean withStack) {
- MUIElement refModel = findElement(perspModel, refId);
- if (refModel instanceof MPart) {
- refModel = refModel.getParent();
- } else if (refModel instanceof MPlaceholder) {
- MUIElement ref = ((MPlaceholder) refModel).getRef();
- if (ref instanceof MPart) {
- refModel = refModel.getParent();
- }
- }
-
MStackElement viewModel = createViewModel(application, viewId, visible, page, partService,
createReferences);
if (viewModel != null) {
@@ -347,9 +337,24 @@ public class ModeledPageLayout implements IPageLayout {
MPartStack stack = insertStack(stackId, relationship, ratio, refId, visible);
stack.getChildren().add(viewModel);
} else {
- insert(viewModel, refModel, plRelToSwt(relationship), ratio);
+ insert(viewModel, findRefModel(refId), plRelToSwt(relationship), ratio);
+ }
+ }
+ }
+
+ private MUIElement findRefModel(String refId) {
+ MUIElement refModel = findElement(perspModel, refId);
+ if (refModel instanceof MPart) {
+ MUIElement parent = refModel.getParent();
+ return parent instanceof MPartStack ? parent : refModel;
+ } else if (refModel instanceof MPlaceholder) {
+ MUIElement ref = ((MPlaceholder) refModel).getRef();
+ if (ref instanceof MPart) {
+ MUIElement parent = refModel.getParent();
+ return parent instanceof MPartStack ? parent : refModel;
}
}
+ return refModel;
}
private MUIElement getLastElement(MUIElement element) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerService.java
index bd7fc74..b469de9 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerService.java
@@ -253,6 +253,12 @@ public class LegacyHandlerService implements IHandlerService {
}
}
+ public LegacyHandlerService(IEclipseContext context, Expression defaultExpression) {
+ eclipseContext = context;
+ evalContext = new ExpressionContext(eclipseContext);
+ this.defaultExpression = defaultExpression;
+ }
+
/*
* (non-Javadoc)
*