Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Rolka2014-09-02 17:23:22 +0000
committerDaniel Rolka2014-09-05 13:52:08 +0000
commit482a6957632e2e18f1b8c1e9d5f611db70ec8ea7 (patch)
tree22792ce16cd741d7900e4923e112bc6d29d3f049
parentbf4e6dc56a1b34eb47abb12254628f747a871404 (diff)
downloadeclipse.platform.ui-482a6957632e2e18f1b8c1e9d5f611db70ec8ea7.tar.gz
eclipse.platform.ui-482a6957632e2e18f1b8c1e9d5f611db70ec8ea7.tar.xz
eclipse.platform.ui-482a6957632e2e18f1b8c1e9d5f611db70ec8ea7.zip
Bug 432498 - [Trim] Fast views get created on start-up
Change-Id: Ie636926c77db80db309a63f66d33bb3d3d96c210 Signed-off-by: Daniel Rolka <daniel.rolka@pl.ibm.com>
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/minmax/TrimStack.java7
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/LazyStackRenderer.java8
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java9
-rw-r--r--bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/workbench/IPresentationEngine.java9
4 files changed, 27 insertions, 6 deletions
diff --git a/bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/minmax/TrimStack.java b/bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/minmax/TrimStack.java
index 89b82bd5695..1572677d7da 100644
--- a/bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/minmax/TrimStack.java
+++ b/bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/minmax/TrimStack.java
@@ -988,6 +988,13 @@ public class TrimStack {
if (minimizedElement instanceof MPartStack) {
MPartStack theStack = (MPartStack) minimizedElement;
MStackElement curSel = theStack.getSelectedElement();
+
+ // Hack for elems that are lazy initialized
+ if (curSel.getRenderer() == null) {
+ theStack.setSelectedElement(null);
+ theStack.setSelectedElement(curSel);
+ }
+
if (curSel instanceof MPart) {
partService.activate((MPart) curSel);
} else if (curSel instanceof MPlaceholder) {
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/LazyStackRenderer.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/LazyStackRenderer.java
index c82f51c4eaf..b400bd63be7 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/LazyStackRenderer.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/LazyStackRenderer.java
@@ -88,8 +88,9 @@ public abstract class LazyStackRenderer extends SWTPartRenderer {
@Override
public void postProcess(MUIElement element) {
- if (!(element instanceof MGenericStack<?>))
+ if (!(element instanceof MGenericStack<?>) || isMinimizedStack(element)) {
return;
+ }
MGenericStack<MUIElement> stack = (MGenericStack<MUIElement>) element;
MUIElement selPart = stack.getSelectedElement();
@@ -295,4 +296,9 @@ public abstract class LazyStackRenderer extends SWTPartRenderer {
layoutShellLater.layout(true, true);
}
}
+
+ private boolean isMinimizedStack(MUIElement stack) {
+ return stack.getTags().contains(IPresentationEngine.MINIMIZED)
+ && !stack.getTags().contains(IPresentationEngine.ACTIVE);
+ }
}
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java
index f220c001430..805f1501bb4 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java
@@ -145,6 +145,9 @@ public class StackRenderer extends LazyStackRenderer {
@Inject
IPresentationEngine renderer;
+ @Inject
+ EModelService modelService;
+
private EventHandler itemUpdater;
private EventHandler dirtyUpdater;
@@ -492,12 +495,10 @@ public class StackRenderer extends LazyStackRenderer {
MPartStack pStack = (MPartStack) (partParent instanceof MPartStack ? partParent
: null);
- EModelService ms = newActivePart.getContext().get(
- EModelService.class);
List<String> tags = new ArrayList<String>();
tags.add(CSSConstants.CSS_ACTIVE_CLASS);
- List<MUIElement> activeElements = ms.findElements(
- ms.getTopLevelWindowFor(newActivePart), null,
+ List<MUIElement> activeElements = modelService.findElements(
+ modelService.getTopLevelWindowFor(newActivePart), null,
MUIElement.class, tags);
for (MUIElement element : activeElements) {
if (element instanceof MPartStack && element != pStack) {
diff --git a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/workbench/IPresentationEngine.java b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/workbench/IPresentationEngine.java
index 25e53caf913..69501dbd4a7 100644
--- a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/workbench/IPresentationEngine.java
+++ b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/workbench/IPresentationEngine.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2013 BestSolution.at and others.
+ * Copyright (c) 2009, 2014 BestSolution.at and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -209,6 +209,13 @@ public interface IPresentationEngine {
public static final String DRAGGABLE = "Draggable"; //$NON-NLS-1$
/**
+ * This is the tag name indicates that model element is active
+ *
+ * @since 1.2
+ */
+ public static final String ACTIVE = "active"; //$NON-NLS-1$
+
+ /**
* Creates and returns the UI element for the given model element.
*
* @param element

Back to the top