1 package eu
.etaxonomy
.taxeditor
.molecular
.editor
;
4 import org
.eclipse
.swt
.widgets
.Event
;
5 import org
.eclipse
.swt
.widgets
.Listener
;
6 import org
.eclipse
.ui
.PlatformUI
;
7 import org
.eclipse
.ui
.actions
.ActionFactory
;
8 import org
.eclipse
.ui
.commands
.ICommandService
;
10 import eu
.etaxonomy
.taxeditor
.molecular
.handler
.AbstractAlignmentEditorHandler
;
11 import info
.bioinfweb
.libralign
.alignmentarea
.selection
.SelectionChangeEvent
;
12 import info
.bioinfweb
.libralign
.alignmentarea
.selection
.SelectionListener
;
17 * Listener used to update copy/paste events associated with {@link AlignmentEditor}.
22 public class AlignmentEditorActionUpdater
implements SelectionListener
, Listener
{
23 private static final String
[] IDS
= {ActionFactory
.COPY
.getCommandId(), ActionFactory
.CUT
.getCommandId(),
24 ActionFactory
.PASTE
.getCommandId()};
27 private void updateEvents() {
28 ICommandService service
= (ICommandService
)PlatformUI
.getWorkbench().getService(ICommandService
.class);
29 for (int i
= 0; i
< IDS
.length
; i
++) {
30 service
.refreshElements(IDS
[i
], null);
36 public void handleEvent(Event event
) {
37 AlignmentEditor editor
= AbstractAlignmentEditorHandler
.getActiveAlignmentEditor();
45 public void selectionChanged(SelectionChangeEvent e
) {
46 AlignmentEditor editor
= AbstractAlignmentEditorHandler
.getActiveAlignmentEditor();
48 if ((e
.getSource() == editor
.getReadsArea().getSelection()) ||
49 (e
.getSource() == editor
.getEditableConsensusArea().getSelection())) {