2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
.editor
.handler
;
15 import org
.eclipse
.core
.commands
.AbstractHandler
;
16 import org
.eclipse
.core
.commands
.ExecutionEvent
;
17 import org
.eclipse
.core
.commands
.ExecutionException
;
18 import org
.eclipse
.ui
.IEditorPart
;
19 import org
.eclipse
.ui
.commands
.IElementUpdater
;
20 import org
.eclipse
.ui
.menus
.UIElement
;
22 import eu
.etaxonomy
.taxeditor
.editor
.molecular
.AlignmentEditor
;
23 import eu
.etaxonomy
.taxeditor
.model
.AbstractUtility
;
28 * Switches an {@link AlignmentEditor} between insertion in the base sequence to the left or to the right.
33 public class ToggleLeftRightInsertionHandler
extends AbstractHandler
implements IElementUpdater
{
34 public static final String COMMAND_ID
=
35 "eu.etaxonomy.taxeditor.editor.molecular.AlignmentEditor.toggleLeftRightInsertion";
39 public Object
execute(ExecutionEvent event
) throws ExecutionException
{
40 IEditorPart activeEditor
= AbstractUtility
.getActiveEditor();
41 if (activeEditor
instanceof AlignmentEditor
) {
42 ((AlignmentEditor
)activeEditor
).toggleLeftRightInsertionInPherogram();
49 public void updateElement(UIElement element
, @SuppressWarnings("rawtypes") Map parameters
) {
50 IEditorPart activeEditor
= AbstractUtility
.getActiveEditor();
51 if (activeEditor
instanceof AlignmentEditor
) {
52 //TODO Use icons instead.
53 if (((AlignmentEditor
)activeEditor
).isInsertLeftInPherogram()) {
54 element
.setText(" Left ");
55 element
.setTooltip("Click to switch to insert new distorsions of the base call sequence right of future edits.");
58 element
.setText("Right");
59 element
.setTooltip("Click to switch to insert new distorsions of the base call sequence left of future edits.");