Revision 033aad78
Added by Katja Luther over 7 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/handler/RemotingCreateSiblingPolytomousKeyNodeHandler.java | ||
---|---|---|
14 | 14 |
import org.eclipse.core.runtime.IStatus; |
15 | 15 |
import org.eclipse.core.runtime.Status; |
16 | 16 |
import org.eclipse.jface.viewers.IStructuredSelection; |
17 |
import org.eclipse.ui.IEditorPart; |
|
17 | 18 |
import org.eclipse.ui.handlers.HandlerUtil; |
18 | 19 |
|
19 | 20 |
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode; |
21 |
import eu.etaxonomy.taxeditor.editor.key.KeyEditor; |
|
22 |
import eu.etaxonomy.taxeditor.editor.key.polytomous.IPolytomousKeyEditorPage; |
|
20 | 23 |
import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditorLabels; |
21 | 24 |
import eu.etaxonomy.taxeditor.editor.key.polytomous.operation.RemotingCreatePolytomousKeyNodeOperation; |
22 |
import eu.etaxonomy.taxeditor.operation.RemotingCdmHandler; |
|
23 | 25 |
|
24 | 26 |
/** |
25 | 27 |
* @author cmathew |
26 | 28 |
* @date 21 Jul 2015 |
27 | 29 |
* |
28 | 30 |
*/ |
29 |
public class RemotingCreateSiblingPolytomousKeyNodeHandler extends RemotingCdmHandler {
|
|
31 |
public class RemotingCreateSiblingPolytomousKeyNodeHandler extends AbstractPolytomousKeyNodeHandler {
|
|
30 | 32 |
|
31 | 33 |
private PolytomousKeyNode parentNode; |
32 | 34 |
|
35 |
|
|
33 | 36 |
public RemotingCreateSiblingPolytomousKeyNodeHandler() { |
34 | 37 |
super(PolytomousKeyEditorLabels.CREATE_SIBLING_POLYTOMOUS_KEY_NODE_LABEL); |
35 | 38 |
} |
... | ... | |
38 | 41 |
*/ |
39 | 42 |
@Override |
40 | 43 |
public IStatus allowOperations(ExecutionEvent event) { |
41 |
|
|
44 |
IEditorPart editor = HandlerUtil.getActiveEditor(event); |
|
42 | 45 |
IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event); |
43 |
|
|
46 |
editorPage = (IPolytomousKeyEditorPage) ((KeyEditor) editor) |
|
47 |
.getActiveEditor(); |
|
44 | 48 |
if (selection.getFirstElement() instanceof PolytomousKeyNode) { |
45 | 49 |
parentNode = (PolytomousKeyNode) selection.getFirstElement(); |
46 | 50 |
} else { |
... | ... | |
57 | 61 |
*/ |
58 | 62 |
@Override |
59 | 63 |
public AbstractOperation prepareOperation(ExecutionEvent event) { |
60 |
return new RemotingCreatePolytomousKeyNodeOperation(event.getTrigger(), false, parentNode.getParent()); |
|
64 |
return new RemotingCreatePolytomousKeyNodeOperation(event.getTrigger(), false, parentNode.getParent(), editorPage);
|
|
61 | 65 |
} |
62 | 66 |
|
63 | 67 |
/* (non-Javadoc) |
Also available in: Unified diff
all polytomouskey related handler are now extended from RemotingCdmHandler