2 * Copyright (C) 2015 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.taxeditor
.editor
.key
.polytomous
.handler
;
11 import org
.eclipse
.core
.commands
.ExecutionEvent
;
12 import org
.eclipse
.core
.commands
.operations
.AbstractOperation
;
13 import org
.eclipse
.core
.runtime
.IStatus
;
14 import org
.eclipse
.core
.runtime
.Status
;
15 import org
.eclipse
.jface
.viewers
.IStructuredSelection
;
16 import org
.eclipse
.ui
.IEditorPart
;
17 import org
.eclipse
.ui
.handlers
.HandlerUtil
;
19 import eu
.etaxonomy
.cdm
.model
.description
.PolytomousKeyNode
;
20 import eu
.etaxonomy
.taxeditor
.editor
.key
.KeyEditor
;
21 import eu
.etaxonomy
.taxeditor
.editor
.key
.polytomous
.IPolytomousKeyEditorPage
;
22 import eu
.etaxonomy
.taxeditor
.editor
.key
.polytomous
.PolytomousKeyEditorLabels
;
23 import eu
.etaxonomy
.taxeditor
.editor
.key
.polytomous
.operation
.RemotingCreatePolytomousKeyNodeOperation
;
30 public class RemotingCreateSiblingPolytomousKeyNodeHandler
extends AbstractPolytomousKeyNodeHandler
{
32 private PolytomousKeyNode parentNode
;
35 public RemotingCreateSiblingPolytomousKeyNodeHandler() {
36 super(PolytomousKeyEditorLabels
.CREATE_SIBLING_POLYTOMOUS_KEY_NODE_LABEL
);
39 * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#allowOperations(org.eclipse.core.commands.ExecutionEvent)
42 public IStatus
allowOperations(ExecutionEvent event
) {
43 IEditorPart editor
= HandlerUtil
.getActiveEditor(event
);
44 IStructuredSelection selection
= (IStructuredSelection
) HandlerUtil
.getCurrentSelection(event
);
45 editorPage
= (IPolytomousKeyEditorPage
) ((KeyEditor
) editor
)
47 if (selection
.getFirstElement() instanceof PolytomousKeyNode
) {
48 parentNode
= (PolytomousKeyNode
) selection
.getFirstElement();
50 return new Status(IStatus
.ERROR
,
51 "unknown", //$NON-NLS-1$
52 PolytomousKeyEditorLabels
.NO_KEY_NODE_FOR_INSERT_NODE_SELECTED_MESSAGE
);
55 return Status
.OK_STATUS
;
59 * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#prepareOperation(org.eclipse.core.commands.ExecutionEvent)
62 public AbstractOperation
prepareOperation(ExecutionEvent event
) {
63 return new RemotingCreatePolytomousKeyNodeOperation(event
.getTrigger(), false, parentNode
.getParent(), editorPage
);
67 * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#onComplete()
70 public void onComplete() {
71 // TODO Auto-generated method stub