Merge branch 'LibrAlign' into develop
[taxeditor.git] / eu.etaxonomy.taxeditor.molecular / src / main / java / eu / etaxonomy / taxeditor / molecular / handler / ShowPherogramHandler.java
index f9773aad3af7eb845ff29c0740541bf52b66e989..f4c658084b6e9f38b80ac456b5a5565bfa3e4036 100644 (file)
@@ -1,66 +1,66 @@
-package eu.etaxonomy.taxeditor.molecular.handler;\r
-\r
-\r
-import info.bioinfweb.libralign.pherogram.model.PherogramComponentModel;\r
-\r
-import java.net.URI;\r
-\r
-import org.eclipse.core.commands.AbstractHandler;\r
-import org.eclipse.core.commands.ExecutionEvent;\r
-import org.eclipse.core.commands.ExecutionException;\r
-import org.eclipse.jface.viewers.ISelection;\r
-import org.eclipse.jface.viewers.TreeNode;\r
-import org.eclipse.ui.PartInitException;\r
-import org.eclipse.ui.handlers.HandlerUtil;\r
-\r
-import eu.etaxonomy.cdm.model.media.MediaUtils;\r
-import eu.etaxonomy.cdm.model.molecular.SingleRead;\r
-import eu.etaxonomy.taxeditor.editor.EditorUtil;\r
-import eu.etaxonomy.taxeditor.model.MessagingUtils;\r
-import eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin;\r
-import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;\r
-import eu.etaxonomy.taxeditor.molecular.editor.PherogramViewPart;\r
-\r
-\r
-\r
-/**\r
- * Displays an undistorted pherogram with {@link PherogramViewPart}.\r
- *\r
- * @author Ben Stöver\r
- *\r
- */\r
-public class ShowPherogramHandler extends AbstractHandler {\r
-       public static void showPherogram(PherogramComponentModel model) throws PartInitException {\r
-               PherogramViewPart.createView(model);\r
-       }\r
-\r
-\r
-       @Override\r
-       public Object execute(ExecutionEvent event) throws ExecutionException {\r
-               ISelection currentSelection = HandlerUtil.getCurrentSelection(event);\r
-               TreeNode treeNodeOfSelection = EditorUtil.getTreeNodeOfSelection(currentSelection);\r
-               if (treeNodeOfSelection != null && treeNodeOfSelection.getValue() instanceof SingleRead) {\r
-                   //TODO Can the parent node (containing the cut positions) be extracted from SingleRead?\r
-                       try {\r
-                           SingleRead singleRead = (SingleRead)treeNodeOfSelection.getValue();\r
-                           URI uri = null;\r
-                           if (singleRead.getPherogram() != null) {  // Pherogram objects without URI are possible.\r
-                               uri = MediaUtils.getFirstMediaRepresentationPart(singleRead.getPherogram()).getUri();\r
-                           }\r
-\r
-                           if (uri == null) {\r
-                       MessagingUtils.messageDialog("No pherogram available", this,\r
-                               "The selected read does not have an associated pherogram.");\r
-                           }\r
-                           else {\r
-                     showPherogram(new PherogramComponentModel(AlignmentEditor.readPherogram(uri)));\r
-                           }\r
-                       }\r
-               catch (Exception e) {\r
-                   MessagingUtils.errorDialog("Error", null, e.getLocalizedMessage(), TaxeditorMolecularPlugin.PLUGIN_ID,\r
-                           e, false);\r
-               }\r
-        }\r
-        return null;\r
-    }\r
-}\r
+package eu.etaxonomy.taxeditor.molecular.handler;
+
+
+import info.bioinfweb.libralign.pherogram.model.PherogramComponentModel;
+
+import java.net.URI;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.TreeNode;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+import eu.etaxonomy.cdm.model.media.MediaUtils;
+import eu.etaxonomy.cdm.model.molecular.SingleRead;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin;
+import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
+import eu.etaxonomy.taxeditor.molecular.editor.PherogramViewPart;
+
+
+
+/**
+ * Displays an undistorted pherogram with {@link PherogramViewPart}.
+ *
+ * @author Ben Stöver
+ *
+ */
+public class ShowPherogramHandler extends AbstractHandler {
+       public static void showPherogram(PherogramComponentModel model) throws PartInitException {
+               PherogramViewPart.createView(model);
+       }
+
+
+       @Override
+       public Object execute(ExecutionEvent event) throws ExecutionException {
+               ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
+               TreeNode treeNodeOfSelection = EditorUtil.getTreeNodeOfSelection(currentSelection);
+               if (treeNodeOfSelection != null && treeNodeOfSelection.getValue() instanceof SingleRead) {
+                   //TODO Can the parent node (containing the cut positions) be extracted from SingleRead?
+                       try {
+                           SingleRead singleRead = (SingleRead)treeNodeOfSelection.getValue();
+                           URI uri = null;
+                           if (singleRead.getPherogram() != null) {  // Pherogram objects without URI are possible.
+                               uri = MediaUtils.getFirstMediaRepresentationPart(singleRead.getPherogram()).getUri();
+                           }
+
+                           if (uri == null) {
+                       MessagingUtils.messageDialog("No pherogram available", this,
+                               "The selected read does not have an associated pherogram.");
+                           }
+                           else {
+                     showPherogram(new PherogramComponentModel(AlignmentEditor.readPherogram(uri)));
+                           }
+                       }
+               catch (Exception e) {
+                   MessagingUtils.errorDialog("Error", null, e.getLocalizedMessage(), TaxeditorMolecularPlugin.PLUGIN_ID,
+                           e, false);
+               }
+        }
+        return null;
+    }
+}