Project

General

Profile

« Previous | Next » 

Revision 65fe133d

Added by Ben Stöver over 8 years ago

Cut action for AlignmentEditor implemented.

View differences:

eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/AlignmentEditorActionUpdater.java
1 1
package eu.etaxonomy.taxeditor.molecular.editor;
2 2

  
3 3

  
4
import org.eclipse.swt.widgets.Composite;
5
import org.eclipse.swt.widgets.Control;
6 4
import org.eclipse.swt.widgets.Event;
7 5
import org.eclipse.swt.widgets.Listener;
8 6
import org.eclipse.ui.PlatformUI;
......
10 8
import org.eclipse.ui.commands.ICommandService;
11 9

  
12 10
import eu.etaxonomy.taxeditor.molecular.handler.AbstractAlignmentEditorHandler;
13
import info.bioinfweb.libralign.alignmentarea.AlignmentArea;
14 11
import info.bioinfweb.libralign.alignmentarea.selection.SelectionChangeEvent;
15 12
import info.bioinfweb.libralign.alignmentarea.selection.SelectionListener;
16 13

  
......
23 20
 * @date 25.08.2015
24 21
 */
25 22
public class AlignmentEditorActionUpdater implements SelectionListener, Listener {
26
	private void updateEvents() {
27
        ((ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class)).refreshElements(
28
                ActionFactory.COPY.getCommandId(), null);
23
	private void updateEvents(String[] ids) {
24
		ICommandService service = (ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class);
25
		for (int i = 0; i < ids.length; i++) {
26
	        service.refreshElements(ids[i], null);
27
		}
29 28
	}
30 29
	
31 30
	
......
33 32
	public void handleEvent(Event event) {
34 33
		AlignmentEditor editor = AbstractAlignmentEditorHandler.getActiveAlignmentEditor();
35 34
		if (editor != null) {
36
            updateEvents();
35
            updateEvents(new String[]{ActionFactory.COPY.getCommandId(), ActionFactory.CUT.getCommandId(), 
36
            		ActionFactory.PASTE.getCommandId()});
37 37
		}
38 38
	}
39 39

  
......
45 45
			if ((e.getSource() == editor.getReadsArea().getSelection()) || 
46 46
					(e.getSource() == editor.getEditableConsensusArea().getSelection())) {
47 47
				
48
				updateEvents();
48
				updateEvents(new String[]{ActionFactory.COPY.getCommandId(),  ActionFactory.CUT.getCommandId()});
49 49
			}
50 50
		}
51 51
	}

Also available in: Unified diff