Revision 59d8592e
Added by Patrick Plitzner over 6 years ago
eu.etaxonomy.taxeditor.workbench/src/main/java/eu/etaxonomy/taxeditor/workbench/OpenPartHandler.java | ||
---|---|---|
6 | 6 |
import org.eclipse.core.commands.ParameterizedCommand; |
7 | 7 |
import org.eclipse.e4.core.di.annotations.CanExecute; |
8 | 8 |
import org.eclipse.e4.core.di.annotations.Execute; |
9 |
import org.eclipse.e4.ui.model.application.MApplication; |
|
9 | 10 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
11 |
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack; |
|
12 |
import org.eclipse.e4.ui.workbench.modeling.EModelService; |
|
10 | 13 |
import org.eclipse.e4.ui.workbench.modeling.EPartService; |
11 | 14 |
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState; |
12 | 15 |
|
13 | 16 |
public class OpenPartHandler { |
14 | 17 |
|
15 | 18 |
@Execute |
16 |
public void execute(ParameterizedCommand commandParameters, EPartService partService) { |
|
19 |
public void execute(ParameterizedCommand commandParameters, EPartService partService, MApplication application, EModelService modelService) {
|
|
17 | 20 |
|
18 | 21 |
if (null == commandParameters) { |
19 | 22 |
return; |
... | ... | |
21 | 24 |
Map parameterMap = commandParameters.getParameterMap(); |
22 | 25 |
String partId = parameterMap.get(AppModelId.COMMANDPARAMETER_EU_ETAXONOMY_TAXEDITOR_WORKBENCH_COMMANDPARAMETER_PARTNAME).toString(); |
23 | 26 |
MPart part = partService.createPart(partId); |
27 |
//Add to part stack |
|
28 |
String partStackId = parameterMap.get(AppModelId.COMMANDPARAMETER_EU_ETAXONOMY_TAXEDITOR_WORKBENCH_COMMANDPARAMETER_PARTSTACKID).toString(); |
|
29 |
if(partStackId!=null){ |
|
30 |
MPartStack partStack = WorkbenchUtility.getPartStack(partStackId, application, modelService); |
|
31 |
if(partStack!=null){ |
|
32 |
partStack.getChildren().add(part); |
|
33 |
} |
|
34 |
} |
|
24 | 35 |
part = partService.showPart(part, PartState.ACTIVATE); |
25 | 36 |
} |
26 | 37 |
|
Also available in: Unified diff
ref #6925 Add partStackId to OpenPartHandler