ref #6913 Remove alignment handler
authorPatrick Plitzner <p.plitzner@bgbm.org>
Fri, 4 May 2018 15:31:41 +0000 (17:31 +0200)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Fri, 4 May 2018 15:31:41 +0000 (17:31 +0200)
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/AlignmentEditorActionUpdater.java
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/AbstractAlignmentEditorHandler.java [deleted file]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/HandlerTools.java

index 304b9f87ae6c1ccc27297f5af66c088747635583..52bc5e7eb4459c3cc6427ca27362202d32ba5a16 100644 (file)
@@ -8,7 +8,7 @@ import org.eclipse.ui.actions.ActionFactory;
 import org.eclipse.ui.commands.ICommandService;\r
 \r
 import eu.etaxonomy.taxeditor.molecular.editor.e4.AlignmentEditorE4;\r
-import eu.etaxonomy.taxeditor.molecular.handler.AbstractAlignmentEditorHandler;\r
+import eu.etaxonomy.taxeditor.molecular.handler.HandlerTools;\r
 import info.bioinfweb.libralign.alignmentarea.selection.SelectionChangeEvent;\r
 import info.bioinfweb.libralign.alignmentarea.selection.SelectionListener;\r
 \r
@@ -35,7 +35,7 @@ public class AlignmentEditorActionUpdater implements SelectionListener, Listener
 \r
        @Override\r
        public void handleEvent(Event event) {\r
-               AlignmentEditorE4 editor = AbstractAlignmentEditorHandler.getActiveAlignmentEditor();\r
+               AlignmentEditorE4 editor = HandlerTools.getActiveAlignmentEditor();\r
                if (editor != null) {\r
             updateEvents();\r
                }\r
@@ -44,7 +44,7 @@ public class AlignmentEditorActionUpdater implements SelectionListener, Listener
 \r
        @Override\r
        public void selectionChanged(SelectionChangeEvent e) {\r
-               AlignmentEditorE4 editor = AbstractAlignmentEditorHandler.getActiveAlignmentEditor();\r
+               AlignmentEditorE4 editor = HandlerTools.getActiveAlignmentEditor();\r
                if (editor != null) {\r
                        if ((e.getSource() == editor.getReadsArea().getSelection()) ||\r
                                        (e.getSource() == editor.getEditableConsensusArea().getSelection())) {\r
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/AbstractAlignmentEditorHandler.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/AbstractAlignmentEditorHandler.java
deleted file mode 100644 (file)
index d488252..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
-* 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.handler;
-
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
-import eu.etaxonomy.taxeditor.molecular.editor.e4.AlignmentEditorE4;
-
-
-
-
-/**
- * Abstract implementation for all handlers triggering actions in an active instance of
- * {@link AlignmentEditorE4}.
- *
- * @author Ben Stöver
- * @date 19.06.2015
- */
-public abstract class AbstractAlignmentEditorHandler extends AbstractHandler {
-       public static AlignmentEditorE4 getActiveAlignmentEditor() {
-           Object activeEditor = AbstractUtility.getActiveEditor();
-        if (activeEditor instanceof AlignmentEditorE4) {
-            return (AlignmentEditorE4)activeEditor;
-        }
-        else {
-               return null;
-        }
-       }
-
-
-    @Override
-    public Object execute(ExecutionEvent event) throws ExecutionException {
-       AlignmentEditorE4 editor = getActiveAlignmentEditor();
-        if (editor != null) {
-            doExecute(event, editor);
-        }
-        return null;
-    }
-
-
-    protected abstract void doExecute(ExecutionEvent event, AlignmentEditorE4 editor) throws ExecutionException;
-}
index 77792d62f869e46e1809a6390bfed8e7ce0774bb..c79a0305bc637e6dce1e9b9d7117842c4f6df0b3 100644 (file)
@@ -15,7 +15,9 @@ import org.eclipse.core.runtime.FileLocator;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.jface.resource.ImageDescriptor;
 
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin;
+import eu.etaxonomy.taxeditor.molecular.editor.e4.AlignmentEditorE4;
 import eu.etaxonomy.taxeditor.molecular.l10n.Messages;
 
 
@@ -37,4 +39,13 @@ public class HandlerTools {  //TODO Move this class or method somewhere else?
             throw new InternalError(String.format(Messages.HandlerTools_COULD_NOT_LOAD_ICON, iconName));  //TODO Throw other type of exception?
         }
     }
+    public static AlignmentEditorE4 getActiveAlignmentEditor() {
+        Object activeEditor = AbstractUtility.getActiveEditor();
+        if (activeEditor instanceof AlignmentEditorE4) {
+            return (AlignmentEditorE4)activeEditor;
+        }
+        else {
+            return null;
+        }
+    }
 }