1 package eu
.etaxonomy
.taxeditor
.editor
.handler
;
5 import java
.util
.ArrayList
;
9 import org
.eclipse
.core
.commands
.AbstractHandler
;
10 import org
.eclipse
.core
.commands
.ExecutionEvent
;
11 import org
.eclipse
.core
.commands
.ExecutionException
;
12 import org
.eclipse
.jface
.viewers
.ISelection
;
13 import org
.eclipse
.jface
.viewers
.TreeNode
;
14 import org
.eclipse
.ui
.PartInitException
;
15 import org
.eclipse
.ui
.handlers
.HandlerUtil
;
17 import eu
.etaxonomy
.cdm
.model
.molecular
.Sequence
;
18 import eu
.etaxonomy
.taxeditor
.editor
.EditorUtil
;
19 import eu
.etaxonomy
.taxeditor
.editor
.molecular
.AlignmentEditorInput
;
24 * Opens the alignment editor from the CDM tree.
26 * @author Ben Stöver
29 public class EditSequenceHandler
extends AbstractHandler
{
31 public Object
execute(ExecutionEvent event
) throws ExecutionException
{
32 ISelection currentSelection
= HandlerUtil
.getCurrentSelection(event
);
33 TreeNode treeNodeOfSelection
= EditorUtil
.getTreeNodeOfSelection(currentSelection
);
34 if(treeNodeOfSelection
!= null && treeNodeOfSelection
.getValue() instanceof Sequence
){
35 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.
37 EditorUtil
.open(input
);
39 catch (PartInitException e
) {
40 // TODO Auto-generated catch block