aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2013-09-06 10:31:50 (EDT)
committerGerrit Code Review @ Eclipse.org2013-09-24 10:20:44 (EDT)
commitf350f9230f91a74928986fefe812bd91e29ac8d6 (patch)
treea169d76c2d16705b358c8bb5a79c3297b5027ebf
parent0243f27bd96c6c7690325b2726194e019103eb65 (diff)
downloadeclipse.platform.ui-f350f9230f91a74928986fefe812bd91e29ac8d6.zip
eclipse.platform.ui-f350f9230f91a74928986fefe812bd91e29ac8d6.tar.gz
eclipse.platform.ui-f350f9230f91a74928986fefe812bd91e29ac8d6.tar.bz2
Bug 331690 - Update our EventBroker usage in add-onsrefs/changes/91/16191/3
Changes the MinMax addon to use @UiEventTopic Change-Id: Ib8c2551fa9e0a1ddf6223630828c45599d303405 Signed-off-by: Lars Vogel <Lars.Vogel@gmail.com>
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/minmax/MinMaxAddon.java504
1 files changed, 257 insertions, 247 deletions
diff --git a/bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/minmax/MinMaxAddon.java b/bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/minmax/MinMaxAddon.java
index 838b541..6f1790b 100644
--- a/bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/minmax/MinMaxAddon.java
+++ b/bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/minmax/MinMaxAddon.java
@@ -7,17 +7,18 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Lars Vogel (Lars.Vogel@gmail.com) - Bug 331690
******************************************************************************/
package org.eclipse.e4.ui.workbench.addons.minmax;
import java.util.ArrayList;
import java.util.List;
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
import javax.inject.Inject;
import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.core.services.events.IEventBroker;
+import org.eclipse.e4.ui.di.UIEventTopic;
import org.eclipse.e4.ui.internal.workbench.swt.AbstractPartRenderer;
import org.eclipse.e4.ui.internal.workbench.swt.AnimationEngine;
import org.eclipse.e4.ui.internal.workbench.swt.FaderAnimationFeedback;
@@ -48,7 +49,6 @@ import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.osgi.service.event.Event;
-import org.osgi.service.event.EventHandler;
/**
* Workbench addon that provides methods to minimize, maximize and restore parts in the window
@@ -88,72 +88,6 @@ public class MinMaxAddon {
@Inject
MAddon minMaxAddon;
- private EventHandler perspSavedListener = new EventHandler() {
- public void handleEvent(Event event) {
- final MPerspective savedPersp = (MPerspective) event.getProperty(EventTags.ELEMENT);
- String cache = getTrimCache(savedPersp);
- minMaxAddon.getPersistedState().put(savedPersp.getElementId(), cache);
- }
-
- private String getTrimCache(MPerspective savedPersp) {
- MWindow topWin = modelService.getTopLevelWindowFor(savedPersp);
- String perspIdStr = '(' + savedPersp.getElementId() + ')';
-
- String cache = getWinCache(topWin, perspIdStr);
- for (MWindow dw : savedPersp.getWindows()) {
- cache += getWinCache(dw, perspIdStr);
- }
-
- return cache;
- }
-
- private String getWinCache(MWindow win, String perspIdStr) {
- String winStr = ""; //$NON-NLS-1$
-
- List<MPartStack> stackList = modelService.findElements(win, null, MPartStack.class,
- null);
- for (MPartStack stack : stackList) {
- winStr += getStackTrimLoc(stack, perspIdStr);
- }
- return winStr;
- }
-
- private String getStackTrimLoc(MPartStack stack, String perspIdStr) {
- MWindow stackWin = modelService.getTopLevelWindowFor(stack);// getContainingWindow(stack);
- MUIElement tcElement = modelService.find(stack.getElementId() + perspIdStr, stackWin);
- if (tcElement == null)
- return ""; //$NON-NLS-1$
-
- MTrimBar bar = (MTrimBar) ((MUIElement) tcElement.getParent());
- int sideVal = bar.getSide().getValue();
- int index = bar.getChildren().indexOf(tcElement);
- return stack.getElementId() + ' ' + sideVal + ' ' + index + "#"; //$NON-NLS-1$
- }
- };
-
- private EventHandler perspOpenedListener = new EventHandler() {
- public void handleEvent(Event event) {
- final MPerspective openedPersp = (MPerspective) event.getProperty(EventTags.ELEMENT);
-
- // Find any minimized stacks and show their trim
- MWindow topWin = modelService.getTopLevelWindowFor(openedPersp);
- showMinimizedTrim(topWin);
- for (MWindow dw : openedPersp.getWindows()) {
- showMinimizedTrim(dw);
- }
- }
-
- private void showMinimizedTrim(MWindow win) {
- List<MPartStack> stackList = modelService.findElements(win, null, MPartStack.class,
- null);
- for (MPartStack stack : stackList) {
- if (stack.getTags().contains(IPresentationEngine.MINIMIZED)) {
- createTrim(stack);
- }
- }
- }
- };
-
private CTabFolder2Adapter CTFButtonListener = new CTabFolder2Adapter() {
private MUIElement getElementToChange(CTabFolderEvent event) {
CTabFolder ctf = (CTabFolder) event.widget;
@@ -241,35 +175,6 @@ public class MinMaxAddon {
}
};
- private EventHandler widgetListener = new EventHandler() {
- public void handleEvent(Event event) {
- final MUIElement changedElement = (MUIElement) event.getProperty(EventTags.ELEMENT);
- if (!(changedElement instanceof MPartStack) && !(changedElement instanceof MArea))
- return;
-
- final CTabFolder ctf = getCTFFor(changedElement);
- if (ctf == null)
- return;
-
- MUIElement stateElement = changedElement;
- if (changedElement instanceof MPartStack) {
- MPartStack stack = (MPartStack) changedElement;
- MArea area = getAreaFor(stack);
- if (area != null && !(area.getWidget() instanceof CTabFolder))
- stateElement = area.getCurSharedRef();
- } else if (changedElement instanceof MArea)
- stateElement = changedElement.getCurSharedRef();
-
- adjustCTFButtons(stateElement);
-
- ctf.removeCTabFolder2Listener(CTFButtonListener); // Prevent multiple instances
- ctf.addCTabFolder2Listener(CTFButtonListener);
-
- ctf.removeMouseListener(CTFDblClickListener); // Prevent multiple instances
- ctf.addMouseListener(CTFDblClickListener);
- }
- };
-
private void setState(MUIElement element, String state) {
element.getTags().remove(MINIMIZED_BY_ZOOM);
if (MINIMIZED.equals(state)) {
@@ -285,189 +190,294 @@ public class MinMaxAddon {
}
- private EventHandler perspectiveChangeListener = new EventHandler() {
- public void handleEvent(Event event) {
- final MUIElement changedElement = (MUIElement) event.getProperty(EventTags.ELEMENT);
- if (!(changedElement instanceof MPerspectiveStack))
- return;
+ @Inject
+ @Optional
+ private void subscribeTopicWidget(@UIEventTopic(UIEvents.UIElement.TOPIC_WIDGET) Event event) {
+ final MUIElement changedElement = (MUIElement) event.getProperty(EventTags.ELEMENT);
+ if (!(changedElement instanceof MPartStack) && !(changedElement instanceof MArea))
+ return;
- MPerspectiveStack ps = (MPerspectiveStack) changedElement;
- MWindow window = modelService.getTopLevelWindowFor(ps);
- List<MToolControl> tcList = modelService.findElements(window, null, MToolControl.class,
- null);
+ final CTabFolder ctf = getCTFFor(changedElement);
+ if (ctf == null)
+ return;
- final MPerspective curPersp = ps.getSelectedElement();
- if (curPersp != null) {
- List<String> tags = new ArrayList<String>();
- tags.add(IPresentationEngine.MINIMIZED);
+ MUIElement stateElement = changedElement;
+ if (changedElement instanceof MPartStack) {
+ MPartStack stack = (MPartStack) changedElement;
+ MArea area = getAreaFor(stack);
+ if (area != null && !(area.getWidget() instanceof CTabFolder))
+ stateElement = area.getCurSharedRef();
+ } else if (changedElement instanceof MArea)
+ stateElement = changedElement.getCurSharedRef();
- List<MUIElement> minimizedElements = modelService.findElements(curPersp, null,
- MUIElement.class, tags);
- // Show any minimized stack from the current perspective
- String perspId = '(' + curPersp.getElementId() + ')';
- for (MUIElement ele : minimizedElements) {
- String fullId = ele.getElementId() + perspId;
+ adjustCTFButtons(stateElement);
- for (MToolControl tc : tcList) {
- if (fullId.equals(tc.getElementId())) {
- tc.setToBeRendered(true);
- }
+ ctf.removeCTabFolder2Listener(CTFButtonListener); // Prevent multiple instances
+ ctf.addCTabFolder2Listener(CTFButtonListener);
+
+ ctf.removeMouseListener(CTFDblClickListener); // Prevent multiple instances
+ ctf.addMouseListener(CTFDblClickListener);
+ }
+
+ /**
+ * Handles removals from the perspective
+ *
+ * @param event
+ */
+
+ @Inject
+ @Optional
+ private void subscribeTopicChildren(
+ @UIEventTopic(UIEvents.ElementContainer.TOPIC_CHILDREN) Event event) {
+ final MUIElement changedElement = (MUIElement) event.getProperty(EventTags.ELEMENT);
+ if (!(changedElement instanceof MPerspectiveStack)
+ || modelService.getTopLevelWindowFor(changedElement) == null)
+ return;
+
+ if (UIEvents.isREMOVE(event)) {
+ for (Object removedElement : UIEvents.asIterable(event, UIEvents.EventTags.OLD_VALUE)) {
+ MUIElement removed = (MUIElement) removedElement;
+ String perspectiveId = removed.getElementId();
+ MWindow window = modelService.getTopLevelWindowFor(changedElement);
+ MTrimBar bar = modelService.getTrim((MTrimmedWindow) window, SideValue.TOP);
+
+ // gather up any minimized stacks for this perspective...
+ List<MToolControl> toRemove = new ArrayList<MToolControl>();
+ for (MUIElement child : bar.getChildren()) {
+ String trimElementId = child.getElementId();
+ if (child instanceof MToolControl && trimElementId.contains(perspectiveId)) {
+ toRemove.add((MToolControl) child);
}
}
- // Find the editor 'area'
- MPlaceholder eaPlaceholder = (MPlaceholder) modelService.find(ID_EDITOR_AREA,
- curPersp);
- adjustCTFButtons(eaPlaceholder);
+ // ...and remove them
+ for (MToolControl minStack : toRemove) {
+ minStack.setToBeRendered(false);
+ bar.getChildren().remove(minStack);
+ }
}
+ }
+ }
+
+ /**
+ * Handles changes of the perspective
+ *
+ * @param event
+ */
+
+ @Inject
+ @Optional
+ private void subscribeTopicSelectedElement(
+ @UIEventTopic(UIEvents.ElementContainer.TOPIC_SELECTEDELEMENT) Event event) {
+ final MUIElement changedElement = (MUIElement) event.getProperty(EventTags.ELEMENT);
+ if (!(changedElement instanceof MPerspectiveStack))
+ return;
+
+ MPerspectiveStack ps = (MPerspectiveStack) changedElement;
+ MWindow window = modelService.getTopLevelWindowFor(ps);
+ List<MToolControl> tcList = modelService.findElements(window, null, MToolControl.class,
+ null);
+
+ final MPerspective curPersp = ps.getSelectedElement();
+ if (curPersp != null) {
+ List<String> tags = new ArrayList<String>();
+ tags.add(IPresentationEngine.MINIMIZED);
+
+ List<MUIElement> minimizedElements = modelService.findElements(curPersp, null,
+ MUIElement.class, tags);
+ // Show any minimized stack from the current perspective
+ String perspId = '(' + curPersp.getElementId() + ')';
+ for (MUIElement ele : minimizedElements) {
+ String fullId = ele.getElementId() + perspId;
- // Hide any minimized stacks from the old perspective
- if (event.getProperty(EventTags.OLD_VALUE) instanceof MPerspective) {
- MPerspective oldPersp = (MPerspective) event.getProperty(EventTags.OLD_VALUE);
- String perspId = '(' + oldPersp.getElementId() + ')';
for (MToolControl tc : tcList) {
- if (tc.getObject() instanceof TrimStack && tc.getElementId().contains(perspId)) {
- TrimStack ts = (TrimStack) tc.getObject();
- ts.showStack(false);
- tc.setToBeRendered(false);
+ if (fullId.equals(tc.getElementId())) {
+ tc.setToBeRendered(true);
}
}
}
- final Shell winShell = (Shell) window.getWidget();
- winShell.getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (!winShell.isDisposed()) {
- winShell.layout(true, true);
- }
+ // Find the editor 'area'
+ MPlaceholder eaPlaceholder = (MPlaceholder) modelService.find(ID_EDITOR_AREA, curPersp);
+ adjustCTFButtons(eaPlaceholder);
+ }
+
+ // Hide any minimized stacks from the old perspective
+ if (event.getProperty(EventTags.OLD_VALUE) instanceof MPerspective) {
+ MPerspective oldPersp = (MPerspective) event.getProperty(EventTags.OLD_VALUE);
+ String perspId = '(' + oldPersp.getElementId() + ')';
+ for (MToolControl tc : tcList) {
+ if (tc.getObject() instanceof TrimStack && tc.getElementId().contains(perspId)) {
+ TrimStack ts = (TrimStack) tc.getObject();
+ ts.showStack(false);
+ tc.setToBeRendered(false);
}
- });
+ }
}
- };
+
+ final Shell winShell = (Shell) window.getWidget();
+ winShell.getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ if (!winShell.isDisposed()) {
+ winShell.layout(true, true);
+ }
+ }
+ });
+ }
/**
- * If a perspective ID changes fix any TrimStacks that reference the old id to point at the new
- * id.
+ * Handles changes in tags
*
- * This keeps trim stacks attached to the correct perspective when a perspective is saved with a
- * new name.
+ * @param event
*/
- private EventHandler idChangeListener = new EventHandler() {
- public void handleEvent(Event event) {
- Object changedObject = event.getProperty(EventTags.ELEMENT);
-
- // Only care about MPerspective id changes
- if (!(changedObject instanceof MPerspective))
- return;
-
- MPerspective perspective = (MPerspective) changedObject;
-
- String newID = (String) event.getProperty(UIEvents.EventTags.NEW_VALUE);
- String oldID = (String) event.getProperty(UIEvents.EventTags.OLD_VALUE);
-
- // pattern is trimStackID(perspectiveID)
- newID = '(' + newID + ')';
- oldID = '(' + oldID + ')';
-
- // Search the trim for the window containing the perspective
- MWindow perspWin = modelService.getTopLevelWindowFor(perspective);
- if (perspWin == null)
- return;
-
- List<MToolControl> trimStacks = modelService.findElements(perspWin, null,
- MToolControl.class, null);
- for (MToolControl trimStack : trimStacks) {
- // Only care about MToolControls that are TrimStacks
- if (TrimStack.CONTRIBUTION_URI.equals(trimStack.getContributionURI()))
- trimStack.setElementId(trimStack.getElementId().replace(oldID, newID));
+
+ @Inject
+ @Optional
+ private void subscribeTopicTagsChanged(
+ @UIEventTopic(UIEvents.ApplicationElement.TOPIC_TAGS) Event event) {
+ if (ignoreTagChanges)
+ return;
+
+ Object changedObj = event.getProperty(EventTags.ELEMENT);
+
+ if (!(changedObj instanceof MUIElement))
+ return;
+
+ final MUIElement changedElement = (MUIElement) changedObj;
+
+ if (UIEvents.isADD(event)) {
+ if (UIEvents.contains(event, UIEvents.EventTags.NEW_VALUE, MINIMIZED)) {
+ minimize(changedElement);
+ } else if (UIEvents.contains(event, UIEvents.EventTags.NEW_VALUE, MAXIMIZED)) {
+ maximize(changedElement);
+ }
+ } else if (UIEvents.isREMOVE(event)) {
+ if (UIEvents.contains(event, UIEvents.EventTags.OLD_VALUE, MINIMIZED)) {
+ restore(changedElement);
+ } else if (UIEvents.contains(event, UIEvents.EventTags.OLD_VALUE, MAXIMIZED)) {
+ unzoom(changedElement);
}
}
- };
+ }
+
+ /**
+ * Handles changes in the id of the element If a perspective ID changes fix any TrimStacks that
+ * reference the old id to point at the new id.
+ *
+ * This keeps trim stacks attached to the correct perspective when a perspective is saved with a
+ * new name.
+ *
+ * @param event
+ */
- private EventHandler tagChangeListener = new EventHandler() {
- public void handleEvent(Event event) {
- if (ignoreTagChanges)
- return;
+ @Inject
+ @Optional
+ private void subscribeTopicElementId(
+ @UIEventTopic(UIEvents.ApplicationElement.TOPIC_ELEMENTID) Event event) {
+ Object changedObject = event.getProperty(EventTags.ELEMENT);
- Object changedObj = event.getProperty(EventTags.ELEMENT);
+ // Only care about MPerspective id changes
+ if (!(changedObject instanceof MPerspective))
+ return;
- if (!(changedObj instanceof MUIElement))
- return;
+ MPerspective perspective = (MPerspective) changedObject;
- final MUIElement changedElement = (MUIElement) changedObj;
+ String newID = (String) event.getProperty(UIEvents.EventTags.NEW_VALUE);
+ String oldID = (String) event.getProperty(UIEvents.EventTags.OLD_VALUE);
- if (UIEvents.isADD(event)) {
- if (UIEvents.contains(event, UIEvents.EventTags.NEW_VALUE, MINIMIZED)) {
- minimize(changedElement);
- } else if (UIEvents.contains(event, UIEvents.EventTags.NEW_VALUE, MAXIMIZED)) {
- maximize(changedElement);
- }
- } else if (UIEvents.isREMOVE(event)) {
- if (UIEvents.contains(event, UIEvents.EventTags.OLD_VALUE, MINIMIZED)) {
- restore(changedElement);
- } else if (UIEvents.contains(event, UIEvents.EventTags.OLD_VALUE, MAXIMIZED)) {
- unzoom(changedElement);
- }
- }
+ // pattern is trimStackID(perspectiveID)
+ newID = '(' + newID + ')';
+ oldID = '(' + oldID + ')';
+
+ // Search the trim for the window containing the perspective
+ MWindow perspWin = modelService.getTopLevelWindowFor(perspective);
+ if (perspWin == null)
+ return;
+
+ List<MToolControl> trimStacks = modelService.findElements(perspWin, null,
+ MToolControl.class, null);
+ for (MToolControl trimStack : trimStacks) {
+ // Only care about MToolControls that are TrimStacks
+ if (TrimStack.CONTRIBUTION_URI.equals(trimStack.getContributionURI()))
+ trimStack.setElementId(trimStack.getElementId().replace(oldID, newID));
}
- };
+ }
- private EventHandler perspectiveRemovedListener = new EventHandler() {
- public void handleEvent(Event event) {
- final MUIElement changedElement = (MUIElement) event.getProperty(EventTags.ELEMENT);
- if (!(changedElement instanceof MPerspectiveStack)
- || modelService.getTopLevelWindowFor(changedElement) == null)
- return;
-
- if (UIEvents.isREMOVE(event)) {
- for (Object removedElement : UIEvents.asIterable(event,
- UIEvents.EventTags.OLD_VALUE)) {
- MUIElement removed = (MUIElement) removedElement;
- String perspectiveId = removed.getElementId();
- MWindow window = modelService.getTopLevelWindowFor(changedElement);
- MTrimBar bar = modelService.getTrim((MTrimmedWindow) window, SideValue.TOP);
-
- // gather up any minimized stacks for this perspective...
- List<MToolControl> toRemove = new ArrayList<MToolControl>();
- for (MUIElement child : bar.getChildren()) {
- String trimElementId = child.getElementId();
- if (child instanceof MToolControl && trimElementId.contains(perspectiveId)) {
- toRemove.add((MToolControl) child);
- }
- }
+ /**
+ * Handles the event that the perspective is saved
+ *
+ * @param event
+ */
- // ...and remove them
- for (MToolControl minStack : toRemove) {
- minStack.setToBeRendered(false);
- bar.getChildren().remove(minStack);
- }
- }
- }
+ @Inject
+ @Optional
+ private void subscribeTopicPerspSaved(
+ @UIEventTopic(UIEvents.UILifeCycle.PERSPECTIVE_SAVED) Event event) {
+ final MPerspective savedPersp = (MPerspective) event.getProperty(EventTags.ELEMENT);
+ String cache = getTrimCache(savedPersp);
+ minMaxAddon.getPersistedState().put(savedPersp.getElementId(), cache);
+ }
+
+ private String getTrimCache(MPerspective savedPersp) {
+ MWindow topWin = modelService.getTopLevelWindowFor(savedPersp);
+ String perspIdStr = '(' + savedPersp.getElementId() + ')';
+
+ String cache = getWinCache(topWin, perspIdStr);
+ for (MWindow dw : savedPersp.getWindows()) {
+ cache += getWinCache(dw, perspIdStr);
}
- };
- @PostConstruct
- void hookListeners() {
- eventBroker.subscribe(UIEvents.UIElement.TOPIC_WIDGET, widgetListener);
- eventBroker.subscribe(UIEvents.ElementContainer.TOPIC_CHILDREN, perspectiveRemovedListener);
- eventBroker.subscribe(UIEvents.ElementContainer.TOPIC_SELECTEDELEMENT,
- perspectiveChangeListener);
- eventBroker.subscribe(UIEvents.ApplicationElement.TOPIC_TAGS, tagChangeListener);
- eventBroker.subscribe(UIEvents.ApplicationElement.TOPIC_ELEMENTID, idChangeListener);
-
- eventBroker.subscribe(UIEvents.UILifeCycle.PERSPECTIVE_SAVED, perspSavedListener);
- eventBroker.subscribe(UIEvents.UILifeCycle.PERSPECTIVE_OPENED, perspOpenedListener);
+ return cache;
}
- @PreDestroy
- void unhookListeners() {
- eventBroker.unsubscribe(widgetListener);
- eventBroker.unsubscribe(perspectiveRemovedListener);
- eventBroker.unsubscribe(perspectiveChangeListener);
- eventBroker.unsubscribe(tagChangeListener);
- eventBroker.unsubscribe(idChangeListener);
- eventBroker.unsubscribe(perspSavedListener);
- eventBroker.unsubscribe(perspOpenedListener);
+ private String getWinCache(MWindow win, String perspIdStr) {
+ String winStr = ""; //$NON-NLS-1$
+
+ List<MPartStack> stackList = modelService.findElements(win, null, MPartStack.class, null);
+ for (MPartStack stack : stackList) {
+ winStr += getStackTrimLoc(stack, perspIdStr);
+ }
+ return winStr;
+ }
+
+ private String getStackTrimLoc(MPartStack stack, String perspIdStr) {
+ MWindow stackWin = modelService.getTopLevelWindowFor(stack);// getContainingWindow(stack);
+ MUIElement tcElement = modelService.find(stack.getElementId() + perspIdStr, stackWin);
+ if (tcElement == null)
+ return ""; //$NON-NLS-1$
+
+ MTrimBar bar = (MTrimBar) ((MUIElement) tcElement.getParent());
+ int sideVal = bar.getSide().getValue();
+ int index = bar.getChildren().indexOf(tcElement);
+ return stack.getElementId() + ' ' + sideVal + ' ' + index + "#"; //$NON-NLS-1$
+ }
+
+ /**
+ * Handles the event that the perspective is opened
+ *
+ * @param event
+ */
+ @Inject
+ @Optional
+ private void subscribeTopicPerspOpened(
+ @UIEventTopic(UIEvents.UILifeCycle.PERSPECTIVE_OPENED) Event event) {
+ final MPerspective openedPersp = (MPerspective) event.getProperty(EventTags.ELEMENT);
+
+ // Find any minimized stacks and show their trim
+ MWindow topWin = modelService.getTopLevelWindowFor(openedPersp);
+ showMinimizedTrim(topWin);
+ for (MWindow dw : openedPersp.getWindows()) {
+ showMinimizedTrim(dw);
+ }
+ }
+
+ private void showMinimizedTrim(MWindow win) {
+ List<MPartStack> stackList = modelService.findElements(win, null, MPartStack.class, null);
+ for (MPartStack stack : stackList) {
+ if (stack.getTags().contains(IPresentationEngine.MINIMIZED)) {
+ createTrim(stack);
+ }
+ }
}
private MArea getAreaFor(MPartStack stack) {