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
\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
\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
+++ /dev/null
-/**
-* 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;
-}
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;
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;
+ }
+ }
}