Revision ae137b34
Added by Patrick Plitzner about 7 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/handler/CreateChildNodeHandler.java | ||
---|---|---|
1 | 1 |
/** |
2 |
*
|
|
2 |
* |
|
3 | 3 |
*/ |
4 | 4 |
package eu.etaxonomy.taxeditor.editor.key.polytomous.handler; |
5 | 5 |
|
... | ... | |
18 | 18 |
import eu.etaxonomy.taxeditor.editor.EditorUtil; |
19 | 19 |
import eu.etaxonomy.taxeditor.editor.key.KeyEditor; |
20 | 20 |
import eu.etaxonomy.taxeditor.editor.key.polytomous.IPolytomousKeyEditorPage; |
21 |
import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditorLabels; |
|
21 | 22 |
import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyListEditor; |
22 | 23 |
import eu.etaxonomy.taxeditor.editor.key.polytomous.operation.CreateNodeOperation; |
24 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
|
23 | 25 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
24 | 26 |
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation; |
25 | 27 |
|
26 | 28 |
/** |
27 | 29 |
* @author n.hoffmann |
28 |
*
|
|
30 |
* |
|
29 | 31 |
*/ |
30 | 32 |
public class CreateChildNodeHandler extends AbstractHandler { |
31 | 33 |
|
32 | 34 |
/* |
33 | 35 |
* (non-Javadoc) |
34 |
*
|
|
36 |
* |
|
35 | 37 |
* @see |
36 | 38 |
* org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands. |
37 | 39 |
* ExecutionEvent) |
... | ... | |
48 | 50 |
if (editorPage instanceof PolytomousKeyListEditor) { |
49 | 51 |
PolytomousKeyListEditor klEditor = (PolytomousKeyListEditor) editorPage; |
50 | 52 |
if(klEditor.getTableItemCount() == 0) { |
51 |
PolytomousKey pk = (PolytomousKey)klEditor.getViewerInputKey();
|
|
53 |
PolytomousKey pk = klEditor.getViewerInputKey(); |
|
52 | 54 |
try { |
53 | 55 |
String label = event.getCommand().getName(); |
54 | 56 |
IUndoContext undoContext = EditorUtil.getUndoContext(); |
... | ... | |
56 | 58 |
|
57 | 59 |
AbstractPostOperation operation = new CreateNodeOperation( |
58 | 60 |
label, undoContext, pk.getRoot(), editorPage); |
59 |
EditorUtil.executeOperation(operation);
|
|
61 |
AbstractUtility.executeOperation(operation);
|
|
60 | 62 |
} catch (NotDefinedException e) { |
61 |
MessagingUtils.warn(getClass(), "Command name not set."); |
|
63 |
MessagingUtils.warn(getClass(), "Command name not set."); //$NON-NLS-1$
|
|
62 | 64 |
} |
63 | 65 |
} else { |
64 | 66 |
|
... | ... | |
75 | 77 |
|
76 | 78 |
AbstractPostOperation operation = new CreateNodeOperation( |
77 | 79 |
label, undoContext, keyNode, editorPage); |
78 |
EditorUtil.executeOperation(operation);
|
|
80 |
AbstractUtility.executeOperation(operation);
|
|
79 | 81 |
} catch (NotDefinedException e) { |
80 |
MessagingUtils.warn(getClass(), "Command name not set."); |
|
82 |
MessagingUtils.warn(getClass(), "Command name not set."); //$NON-NLS-1$
|
|
81 | 83 |
} |
82 | 84 |
} else { |
83 | 85 |
MessageDialog.openInformation( |
84 |
EditorUtil.getShell(), |
|
85 |
"No Key Node Selected", |
|
86 |
"Please right-click on a specific key node to create a new child key node."); |
|
86 |
AbstractUtility.getShell(), |
|
87 |
PolytomousKeyEditorLabels.NO_KEY_NODE_SELECTED, |
|
88 |
PolytomousKeyEditorLabels.NO_KEY_NODE_FOR_INSERT_NODE_SELECTED_MESSAGE |
|
89 |
); |
|
87 | 90 |
} |
88 | 91 |
} |
89 | 92 |
} |
Also available in: Unified diff
ref #4611 some l10n for taxeditor and taxeditor.editor plugin