-/**\r
- * Copyright (C) 2007 EDIT\r
- * European Distributed Institute of Taxonomy\r
- * http://www.e-taxonomy.eu\r
- *\r
- * The contents of this file are subject to the Mozilla Public License Version 1.1\r
- * See LICENSE.TXT at the top of this package for the full license terms.\r
- */\r
-\r
-package eu.etaxonomy.taxeditor.molecular.handler;\r
-\r
-import java.util.Map;\r
-\r
-import org.eclipse.core.commands.ExecutionEvent;\r
-import org.eclipse.core.commands.ExecutionException;\r
-import org.eclipse.jface.resource.ImageDescriptor;\r
-import org.eclipse.ui.IEditorPart;\r
-import org.eclipse.ui.commands.IElementUpdater;\r
-import org.eclipse.ui.menus.UIElement;\r
-\r
-import eu.etaxonomy.taxeditor.model.AbstractUtility;\r
-import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;\r
-\r
-\r
-\r
-/**\r
- * Switches an {@link AlignmentEditor} between insertion in the base sequence to\r
- * the left or to the right.\r
- *\r
- * @author Ben Stöver\r
- * @date 04.12.2014\r
- */\r
-public class ToggleLeftRightInsertionHandler extends AbstractAlignmentEditorHandler implements IElementUpdater {\r
- public static final String COMMAND_ID = "eu.etaxonomy.taxeditor.molecular.AlignmentEditor.toggleLeftRightInsertion";\r
-\r
-\r
- private final ImageDescriptor INSERT_LEFT_DESCRIPTOR =\r
- HandlerTools.createImageDescriptor("pherogram-insert-left-16x16.png");\r
- private final ImageDescriptor INSERT_RIGHT_DESCRIPTOR =\r
- HandlerTools.createImageDescriptor("pherogram-insert-right-16x16.png");\r
- private final ImageDescriptor INSERT_LEFT_DISABLED_DESCRIPTOR =\r
- HandlerTools.createImageDescriptor("pherogram-insert-left-disabled-16x16.png");\r
- private final ImageDescriptor INSERT_RIGHT_DISABLED_DESCRIPTOR =\r
- HandlerTools.createImageDescriptor("pherogram-insert-right-disabled-16x16.png");\r
-\r
-\r
- @Override\r
- public void doExecute(ExecutionEvent event, AlignmentEditor editor) throws ExecutionException {\r
- editor.toggleLeftRightInsertionInPherogram();\r
- }\r
-\r
-\r
- @Override\r
- public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) {\r
- IEditorPart activeEditor = AbstractUtility.getActiveEditor();\r
- if (activeEditor instanceof AlignmentEditor) {\r
- setBaseEnabled(((AlignmentEditor)activeEditor).isInsertMode());\r
- if (((AlignmentEditor)activeEditor).isInsertLeftInPherogram()) {\r
- element.setIcon(INSERT_LEFT_DESCRIPTOR);\r
- element.setDisabledIcon(INSERT_LEFT_DISABLED_DESCRIPTOR);\r
- element.setText("Left");\r
- element.setTooltip("Switch to insert pherogram distorsions right of future edits.");\r
- }\r
- else {\r
- element.setIcon(INSERT_RIGHT_DESCRIPTOR);\r
- element.setDisabledIcon(INSERT_RIGHT_DISABLED_DESCRIPTOR);\r
- element.setText("Right");\r
- element.setTooltip("Switch to insert pherogram distorsions left of future edits.");\r
- }\r
- }\r
- }\r
-}\r
+/**
+ * Copyright (C) 2007 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 java.util.Map;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.commands.IElementUpdater;
+import org.eclipse.ui.menus.UIElement;
+
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
+
+
+
+/**
+ * Switches an {@link AlignmentEditor} between insertion in the base sequence to
+ * the left or to the right.
+ *
+ * @author Ben Stöver
+ * @date 04.12.2014
+ */
+public class ToggleLeftRightInsertionHandler extends AbstractAlignmentEditorHandler implements IElementUpdater {
+ public static final String COMMAND_ID = "eu.etaxonomy.taxeditor.molecular.AlignmentEditor.toggleLeftRightInsertion";
+
+
+ private final ImageDescriptor INSERT_LEFT_DESCRIPTOR =
+ HandlerTools.createImageDescriptor("pherogram-insert-left-16x16.png");
+ private final ImageDescriptor INSERT_RIGHT_DESCRIPTOR =
+ HandlerTools.createImageDescriptor("pherogram-insert-right-16x16.png");
+ private final ImageDescriptor INSERT_LEFT_DISABLED_DESCRIPTOR =
+ HandlerTools.createImageDescriptor("pherogram-insert-left-disabled-16x16.png");
+ private final ImageDescriptor INSERT_RIGHT_DISABLED_DESCRIPTOR =
+ HandlerTools.createImageDescriptor("pherogram-insert-right-disabled-16x16.png");
+
+
+ @Override
+ public void doExecute(ExecutionEvent event, AlignmentEditor editor) throws ExecutionException {
+ editor.toggleLeftRightInsertionInPherogram();
+ }
+
+
+ @Override
+ public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) {
+ IEditorPart activeEditor = AbstractUtility.getActiveEditor();
+ if (activeEditor instanceof AlignmentEditor) {
+ setBaseEnabled(((AlignmentEditor)activeEditor).isInsertMode());
+ if (((AlignmentEditor)activeEditor).isInsertLeftInPherogram()) {
+ element.setIcon(INSERT_LEFT_DESCRIPTOR);
+ element.setDisabledIcon(INSERT_LEFT_DISABLED_DESCRIPTOR);
+ element.setText("Left");
+ element.setTooltip("Switch to insert pherogram distorsions right of future edits.");
+ }
+ else {
+ element.setIcon(INSERT_RIGHT_DESCRIPTOR);
+ element.setDisabledIcon(INSERT_RIGHT_DISABLED_DESCRIPTOR);
+ element.setText("Right");
+ element.setTooltip("Switch to insert pherogram distorsions left of future edits.");
+ }
+ }
+ }
+}