1
|
/**
|
2
|
* Copyright (C) 2009 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.taxeditor.editor.definedterm.e4.handler;
|
11
|
import java.util.UUID;
|
12
|
|
13
|
import org.eclipse.e4.core.di.annotations.Execute;
|
14
|
import org.eclipse.e4.ui.model.application.MApplication;
|
15
|
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
16
|
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
|
17
|
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
|
18
|
import org.eclipse.e4.ui.workbench.modeling.EModelService;
|
19
|
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
20
|
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
|
21
|
|
22
|
import eu.etaxonomy.cdm.model.common.TermType;
|
23
|
import eu.etaxonomy.taxeditor.editor.definedterm.e4.DefinedTermEditorE4;
|
24
|
import eu.etaxonomy.taxeditor.editor.definedterm.input.TermEditorInput;
|
25
|
import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility;
|
26
|
|
27
|
|
28
|
/**
|
29
|
*
|
30
|
* @author pplitzner
|
31
|
* @since Aug 22, 2017
|
32
|
*
|
33
|
*/
|
34
|
public class OpenDefinedTermEditorHandlerE4 {
|
35
|
|
36
|
@Execute
|
37
|
public void execute(EPartService partService, MHandledMenuItem menuItem, MApplication application, EModelService modelService) {
|
38
|
|
39
|
String commandId = menuItem.getCommand().getElementId();
|
40
|
UUID termTypeUuid = (UUID) menuItem.getTransientData().get(commandId+".termTypeUuid");
|
41
|
|
42
|
TermEditorInput termEditorInput = new TermEditorInput(TermType.getByUuid(termTypeUuid));
|
43
|
MPart part = partService.createPart(eu.etaxonomy.taxeditor.store.AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_DEFINEDTERM);
|
44
|
MPartStack editorAreaPartStack = WorkbenchUtility.getEditorAreaPartStack(application, modelService);
|
45
|
if(editorAreaPartStack!=null){
|
46
|
editorAreaPartStack.getChildren().add(part);
|
47
|
}
|
48
|
part = partService.showPart(part, PartState.ACTIVATE);
|
49
|
DefinedTermEditorE4 termEditor = (DefinedTermEditorE4) part.getObject();
|
50
|
termEditor.init(termEditorInput);
|
51
|
}
|
52
|
|
53
|
}
|