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
|
package eu.etaxonomy.taxeditor.editor.definedterm.e4.handler;
|
10
|
|
11
|
import javax.inject.Named;
|
12
|
|
13
|
import org.eclipse.core.commands.operations.IUndoContext;
|
14
|
import org.eclipse.e4.core.di.annotations.Execute;
|
15
|
import org.eclipse.e4.ui.di.UISynchronize;
|
16
|
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
17
|
import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem;
|
18
|
import org.eclipse.e4.ui.services.IServiceConstants;
|
19
|
|
20
|
import eu.etaxonomy.taxeditor.editor.definedterm.e4.DefinedTermEditorE4;
|
21
|
import eu.etaxonomy.taxeditor.editor.definedterm.operation.CreateTermVocabularyOperation;
|
22
|
import eu.etaxonomy.taxeditor.model.AbstractUtility;
|
23
|
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
|
24
|
import eu.etaxonomy.taxeditor.store.StoreUtil;
|
25
|
|
26
|
/**
|
27
|
*
|
28
|
* @author pplitzner
|
29
|
* @since Aug 22, 2017
|
30
|
*
|
31
|
*/
|
32
|
public class CreateTermVocabularyHandlerE4 {
|
33
|
|
34
|
@Execute
|
35
|
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart,
|
36
|
MMenuItem menuItem,
|
37
|
UISynchronize sync) {
|
38
|
|
39
|
DefinedTermEditorE4 termEditor = (DefinedTermEditorE4) activePart.getObject();
|
40
|
|
41
|
String label = menuItem.getLocalizedLabel();
|
42
|
IUndoContext undoContext = StoreUtil.getUndoContext();
|
43
|
|
44
|
AbstractPostOperation operation =
|
45
|
new CreateTermVocabularyOperation(label,
|
46
|
undoContext,
|
47
|
termEditor.getDefinedTermEditorInput(),
|
48
|
termEditor);
|
49
|
AbstractUtility.executeOperation(operation, sync);
|
50
|
}
|
51
|
}
|