1 package eu
.etaxonomy
.taxeditor
.editor
.handler
;
6 import org
.eclipse
.core
.commands
.AbstractHandler
;
7 import org
.eclipse
.core
.commands
.ExecutionEvent
;
8 import org
.eclipse
.core
.commands
.ExecutionException
;
9 import org
.eclipse
.jface
.viewers
.ISelection
;
10 import org
.eclipse
.jface
.viewers
.TreeNode
;
11 import org
.eclipse
.ui
.handlers
.HandlerUtil
;
13 import eu
.etaxonomy
.cdm
.model
.media
.MediaUtils
;
14 import eu
.etaxonomy
.cdm
.model
.molecular
.SingleRead
;
15 import eu
.etaxonomy
.taxeditor
.editor
.EditorUtil
;
16 import eu
.etaxonomy
.taxeditor
.editor
.molecular
.PherogramViewPart
;
17 import eu
.etaxonomy
.taxeditor
.model
.MessagingUtils
;
22 * Displays an undistorted pherogram with {@link PherogramViewPart}.
27 public class ShowPherogramHandler
extends AbstractHandler
{
28 public static void showPherogram(URI uri
) {
30 PherogramViewPart
.createView(uri
);
33 MessagingUtils
.errorDialog("Error", null, e
.getLocalizedMessage(), "eu.etaxonomy.taxeditor.editor", //TODO Is null a valid value here?
34 e
, false); //TODO set pluginID
40 public Object
execute(ExecutionEvent event
) throws ExecutionException
{
41 ISelection currentSelection
= HandlerUtil
.getCurrentSelection(event
);
42 TreeNode treeNodeOfSelection
= EditorUtil
.getTreeNodeOfSelection(currentSelection
);
43 if (treeNodeOfSelection
!= null && treeNodeOfSelection
.getValue() instanceof SingleRead
) {
44 showPherogram(MediaUtils
.getFirstMediaRepresentationPart(
45 ((SingleRead
)treeNodeOfSelection
.getValue()).getPherogram()).getUri());