Revision 1c9c9562
Added by Patrick Plitzner over 6 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/handler/CreateDefinedTermHandler.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* Copyright (C) 2009 EDIT |
3 |
* European Distributed Institute of Taxonomy
|
|
3 |
* European Distributed Institute of Taxonomy |
|
4 | 4 |
* http://www.e-taxonomy.eu |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
... | ... | |
11 | 11 |
import org.eclipse.core.commands.AbstractHandler; |
12 | 12 |
import org.eclipse.core.commands.ExecutionEvent; |
13 | 13 |
import org.eclipse.core.commands.ExecutionException; |
14 |
import org.eclipse.core.commands.IHandler; |
|
15 | 14 |
import org.eclipse.core.commands.common.NotDefinedException; |
16 | 15 |
import org.eclipse.core.commands.operations.IUndoContext; |
17 | 16 |
import org.eclipse.jface.viewers.IStructuredSelection; |
... | ... | |
28 | 27 |
/** |
29 | 28 |
* @author l.morris |
30 | 29 |
* @date 21 Dec 2011 |
31 |
*
|
|
30 |
* |
|
32 | 31 |
*/ |
33 |
public class CreateDefinedTermHandler extends AbstractHandler implements IHandler {
|
|
32 |
public class CreateDefinedTermHandler extends AbstractHandler { |
|
34 | 33 |
|
35 |
/* |
|
36 |
* (non-Javadoc) |
|
37 |
* |
|
38 |
* @see |
|
39 |
* org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands. |
|
40 |
* ExecutionEvent) |
|
41 |
*/ |
|
42 | 34 |
@Override |
43 | 35 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
36 |
boolean addTermAsKindOf = |
|
37 |
event.getCommand().getId().equals("eu.etaxonomy.taxeditor.editor.definedTerms.newKindOfTerm")?true:false; |
|
38 |
|
|
44 | 39 |
IPostOperationEnabled editor = (IPostOperationEnabled) HandlerUtil |
45 | 40 |
.getActiveEditor(event); |
46 | 41 |
|
... | ... | |
55 | 50 |
|
56 | 51 |
TermBase termBase = (TermBase) selection.getFirstElement(); |
57 | 52 |
|
58 |
AbstractPostOperation operation =
|
|
59 |
new CreateDefinedTermOperation(label,
|
|
60 |
undoContext,
|
|
61 |
termBase,
|
|
53 |
AbstractPostOperation operation = |
|
54 |
new CreateDefinedTermOperation(label, |
|
55 |
undoContext, |
|
56 |
termBase, |
|
62 | 57 |
dfe.getDefinedTermEditorInput(), |
63 |
editor); |
|
58 |
editor, addTermAsKindOf);
|
|
64 | 59 |
StoreUtil.executeOperation(operation); |
65 | 60 |
|
66 | 61 |
} catch (NotDefinedException e) { |
Also available in: Unified diff
ref #6762 Implement option to add kindOf related terms in term editor