ref #6902 migrate alignment editor and pherogram view
[taxeditor.git] / eu.etaxonomy.taxeditor.molecular / src / main / java / eu / etaxonomy / taxeditor / molecular / editor / e4 / handler / CutPherogramRightHandlerE4.java
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/CutPherogramRightHandlerE4.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/CutPherogramRightHandlerE4.java
new file mode 100644 (file)
index 0000000..a39ec94
--- /dev/null
@@ -0,0 +1,42 @@
+/**
+* Copyright (C) 2015 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.molecular.editor.e4.handler;
+
+
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.services.IServiceConstants;
+
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin;
+import eu.etaxonomy.taxeditor.molecular.editor.e4.AlignmentEditorE4;
+import eu.etaxonomy.taxeditor.molecular.l10n.Messages;
+
+
+
+/**
+ * Handler that cuts the base call sequence of a pherogram attached to the current sequence on the right
+ * of the current selection or cursor position.
+ *
+ * @author BenStoever
+ * @date 15.06.2015
+ */
+public class CutPherogramRightHandlerE4 {
+
+    @Execute
+    public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart) {
+        AlignmentEditorE4 editor = (AlignmentEditorE4) activePart.getObject();
+        String errorMessage = editor.cutPherogramRight();
+        if (errorMessage != null) {
+            MessagingUtils.errorDialog(Messages.CutPherogramRightHandler_CUT_FAILURE, this, errorMessage, TaxeditorMolecularPlugin.PLUGIN_ID, null, false);
+        }
+    }
+}