AlignmentEditorCopyHandler now sets current action status.
[taxeditor.git] / eu.etaxonomy.taxeditor.molecular / src / main / java / eu / etaxonomy / taxeditor / molecular / handler / AbstractAlignmentEditorHandler.java
index 0c8a6edb1ee5d48d53a2a2fc0753ab2e14c1e836..1d44449b9a5e130df0efa9fe9ab3bf3703b3208f 100644 (file)
@@ -29,15 +29,26 @@ import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
  * @date 19.06.2015
  */
 public abstract class AbstractAlignmentEditorHandler extends AbstractHandler {
-    @Override
-    public Object execute(ExecutionEvent event) throws ExecutionException {
+       public static AlignmentEditor getActiveAlignmentEditor() {
         IEditorPart activeEditor = AbstractUtility.getActiveEditor();
         if (activeEditor instanceof AlignmentEditor) {
-            doExecute(event, (AlignmentEditor)activeEditor);
+            return (AlignmentEditor)activeEditor;
+        }
+        else {
+               return null;
+        }
+       }
+       
+       
+    @Override
+    public Object execute(ExecutionEvent event) throws ExecutionException {
+       AlignmentEditor editor = getActiveAlignmentEditor();
+        if (editor != null) {
+            doExecute(event, editor);
         }
         return null;
     }
 
 
-    public abstract void doExecute(ExecutionEvent event, AlignmentEditor editor) throws ExecutionException;
+    protected abstract void doExecute(ExecutionEvent event, AlignmentEditor editor) throws ExecutionException;
 }