1 package eu
.etaxonomy
.taxeditor
.editor
.handler
;
4 import org
.eclipse
.core
.commands
.AbstractHandler
;
5 import org
.eclipse
.core
.commands
.ExecutionEvent
;
6 import org
.eclipse
.core
.commands
.ExecutionException
;
7 import org
.eclipse
.jface
.viewers
.ISelection
;
8 import org
.eclipse
.jface
.viewers
.TreeNode
;
9 import org
.eclipse
.ui
.PartInitException
;
10 import org
.eclipse
.ui
.handlers
.HandlerUtil
;
12 import eu
.etaxonomy
.cdm
.model
.molecular
.Sequence
;
13 import eu
.etaxonomy
.taxeditor
.editor
.EditorUtil
;
14 import eu
.etaxonomy
.taxeditor
.editor
.molecular
.AlignmentEditorInput
;
19 * Opens the alignment editor from the CDM tree.
21 * @author Ben Stöver
24 public class EditSequenceHandler
extends AbstractHandler
{
26 public Object
execute(ExecutionEvent event
) throws ExecutionException
{
27 ISelection currentSelection
= HandlerUtil
.getCurrentSelection(event
);
28 TreeNode treeNodeOfSelection
= EditorUtil
.getTreeNodeOfSelection(currentSelection
);
29 if(treeNodeOfSelection
!= null && treeNodeOfSelection
.getValue() instanceof Sequence
){
30 AlignmentEditorInput input
= new AlignmentEditorInput((Sequence
)treeNodeOfSelection
.getValue()); //TODO Should there always be a new instance created here? What if the specified CDM node is already opened in an AlignmentEditor? => Possible create Singleton that keeps instances by sequence objects in a map.
32 EditorUtil
.open(input
);
34 catch (PartInitException e
) {
35 // TODO Auto-generated catch block