-/**\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
-\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.PlatformUI;\r
-import org.eclipse.ui.commands.ICommandService;\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 and overwrite mode.\r
- *\r
- * @author Ben Stöver\r
- * @date 04.12.2014\r
- */\r
-public class ToggleInsertOverwriteHandler extends AbstractAlignmentEditorHandler implements IElementUpdater {\r
- public static final String COMMAND_ID =\r
- "eu.etaxonomy.taxeditor.molecular.AlignmentEditor.toggleInsertOverwrite";\r
-\r
-\r
- private final ImageDescriptor INSERT_DESCRIPTOR = HandlerTools.createImageDescriptor("insert-16x16.png");\r
- private final ImageDescriptor OVERWRITE_DESCRIPTOR = HandlerTools.createImageDescriptor("overwrite-16x16.png");\r
-\r
-\r
- @Override\r
- public void doExecute(ExecutionEvent event, AlignmentEditor editor) throws ExecutionException {\r
- editor.toggleInsertOverwrite();\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
- if (((AlignmentEditor)activeEditor).isInsertMode()) {\r
- element.setIcon(INSERT_DESCRIPTOR);\r
- element.setText("INS");\r
- element.setTooltip("Click to switch to overwrite mode");\r
- }\r
- else {\r
- element.setIcon(OVERWRITE_DESCRIPTOR);\r
- element.setText("OVR");\r
- element.setTooltip("Click to switch to insertion mode");\r
- }\r
- ((ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class)).refreshElements(\r
- ToggleLeftRightInsertionHandler.COMMAND_ID, null);\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.PlatformUI;
+import org.eclipse.ui.commands.ICommandService;
+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 and overwrite mode.
+ *
+ * @author Ben Stöver
+ * @date 04.12.2014
+ */
+public class ToggleInsertOverwriteHandler extends AbstractAlignmentEditorHandler implements IElementUpdater {
+ public static final String COMMAND_ID =
+ "eu.etaxonomy.taxeditor.molecular.AlignmentEditor.toggleInsertOverwrite";
+
+
+ private final ImageDescriptor INSERT_DESCRIPTOR = HandlerTools.createImageDescriptor("insert-16x16.png");
+ private final ImageDescriptor OVERWRITE_DESCRIPTOR = HandlerTools.createImageDescriptor("overwrite-16x16.png");
+
+
+ @Override
+ public void doExecute(ExecutionEvent event, AlignmentEditor editor) throws ExecutionException {
+ editor.toggleInsertOverwrite();
+ }
+
+
+ @Override
+ public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) {
+ IEditorPart activeEditor = AbstractUtility.getActiveEditor();
+ if (activeEditor instanceof AlignmentEditor) {
+ if (((AlignmentEditor)activeEditor).isInsertMode()) {
+ element.setIcon(INSERT_DESCRIPTOR);
+ element.setText("INS");
+ element.setTooltip("Click to switch to overwrite mode");
+ }
+ else {
+ element.setIcon(OVERWRITE_DESCRIPTOR);
+ element.setText("OVR");
+ element.setTooltip("Click to switch to insertion mode");
+ }
+ ((ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class)).refreshElements(
+ ToggleLeftRightInsertionHandler.COMMAND_ID, null);
+ }
+ }
+}