1 package eu
.etaxonomy
.taxeditor
.molecular
.handler
;
4 import info
.bioinfweb
.libralign
.pherogram
.model
.PherogramComponentModel
;
8 import org
.eclipse
.core
.commands
.AbstractHandler
;
9 import org
.eclipse
.core
.commands
.ExecutionEvent
;
10 import org
.eclipse
.core
.commands
.ExecutionException
;
11 import org
.eclipse
.jface
.viewers
.ISelection
;
12 import org
.eclipse
.jface
.viewers
.TreeNode
;
13 import org
.eclipse
.ui
.PartInitException
;
14 import org
.eclipse
.ui
.handlers
.HandlerUtil
;
16 import eu
.etaxonomy
.cdm
.model
.media
.MediaUtils
;
17 import eu
.etaxonomy
.cdm
.model
.molecular
.SingleRead
;
18 import eu
.etaxonomy
.taxeditor
.editor
.EditorUtil
;
19 import eu
.etaxonomy
.taxeditor
.model
.MessagingUtils
;
20 import eu
.etaxonomy
.taxeditor
.molecular
.TaxeditorMolecularPlugin
;
21 import eu
.etaxonomy
.taxeditor
.molecular
.editor
.AlignmentEditor
;
22 import eu
.etaxonomy
.taxeditor
.molecular
.editor
.PherogramViewPart
;
27 * Displays an undistorted pherogram with {@link PherogramViewPart}.
32 public class ShowPherogramHandler
extends AbstractHandler
{
33 public static void showPherogram(PherogramComponentModel model
) throws PartInitException
{
34 PherogramViewPart
.createView(model
);
39 public Object
execute(ExecutionEvent event
) throws ExecutionException
{
40 ISelection currentSelection
= HandlerUtil
.getCurrentSelection(event
);
41 TreeNode treeNodeOfSelection
= EditorUtil
.getTreeNodeOfSelection(currentSelection
);
42 if (treeNodeOfSelection
!= null && treeNodeOfSelection
.getValue() instanceof SingleRead
) {
43 //TODO Can the parent node (containing the cut positions) be extracted from SingleRead?
45 SingleRead singleRead
= (SingleRead
)treeNodeOfSelection
.getValue();
47 if (singleRead
.getPherogram() != null) { // Pherogram objects without URI are possible.
48 uri
= MediaUtils
.getFirstMediaRepresentationPart(singleRead
.getPherogram()).getUri();
52 MessagingUtils
.messageDialog("No pherogram available", this,
53 "The selected read does not have an associated pherogram.");
56 showPherogram(new PherogramComponentModel(AlignmentEditor
.readPherogram(uri
)));
60 MessagingUtils
.errorDialog("Error", null, e
.getLocalizedMessage(), TaxeditorMolecularPlugin
.PLUGIN_ID
,