1 package org.simantics.workbench.internal.contributions.e4;
3 import org.eclipse.e4.core.di.annotations.CanExecute;
4 import org.eclipse.e4.core.di.annotations.Execute;
5 import org.eclipse.e4.ui.model.application.MApplication;
6 import org.eclipse.e4.ui.model.application.ui.basic.MPart;
7 import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
8 import org.eclipse.e4.ui.model.application.ui.basic.MStackElement;
9 import org.eclipse.e4.ui.workbench.modeling.EModelService;
10 import org.eclipse.e4.ui.workbench.modeling.EPartService;
11 import org.simantics.ui.workbench.e4.E4WorkbenchUtils;
13 public class ActivatePartHandler {
16 public boolean canExecute(MApplication app, EModelService modelService) {
17 MPartStack partStack = E4WorkbenchUtils.getEditorPartStack(modelService, app);
18 if (partStack.getChildren().size() > 0)
24 public void activatePart(MApplication app, EModelService modelService, EPartService partService) {
25 MPartStack partStack = E4WorkbenchUtils.getEditorPartStack(modelService, app);
26 MStackElement elem = partStack.getSelectedElement();
27 MPart part = (MPart) elem;
28 partService.activate(part);