Test implementation of Copy action added to AlignmentEditor.
authorb.stoever <b.stoever@localhost>
Mon, 24 Aug 2015 16:57:35 +0000 (16:57 +0000)
committerb.stoever <b.stoever@localhost>
Mon, 24 Aug 2015 16:57:35 +0000 (16:57 +0000)
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/AlignmentEditor.java

index 2fce7945c844c3a9f686be5af37abd52592a2bf0..35b0a2df6a3f18915452ea3dcd99c7995a5e3029 100644 (file)
@@ -52,6 +52,7 @@ import java.util.TreeMap;
 import org.biojava.bio.chromatogram.ChromatogramFactory;
 import org.biojava.bio.chromatogram.UnsupportedChromatogramFormatException;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.biojava.bio.chromatogram.ChromatogramFactory;
 import org.biojava.bio.chromatogram.UnsupportedChromatogramFormatException;
 import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.action.Action;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.ui.IActionBars;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.ui.IActionBars;
@@ -60,6 +61,7 @@ import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.IEditorSite;
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.IEditorSite;
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.ActionFactory;
 import org.eclipse.ui.commands.ICommandService;
 import org.eclipse.ui.part.EditorPart;
 
 import org.eclipse.ui.commands.ICommandService;
 import org.eclipse.ui.part.EditorPart;
 
@@ -442,6 +444,20 @@ public class AlignmentEditor extends EditorPart {
     public void init(IEditorSite site, IEditorInput input) throws PartInitException {
         setSite(site);
         setInput(input);
     public void init(IEditorSite site, IEditorInput input) throws PartInitException {
         setSite(site);
         setInput(input);
+        System.out.println("AlignmentEditor.init(): " + ActionFactory.COPY.getId());
+        site.getActionBars().setGlobalActionHandler(ActionFactory.COPY.getId(), new Action(ActionFactory.COPY.getId()) {
+            @Override
+            public boolean isEnabled() {
+                System.out.println("isEnabled()");
+                return true;
+            }
+
+            @Override
+            public void run() {
+                System.out.println("run");
+                    super.run();
+                }
+            });
     }
 
 
     }
 
 
@@ -691,12 +707,12 @@ public class AlignmentEditor extends EditorPart {
 
                if (tokens != null) {  // If either an edited sequence or a pherogram URI was provided.
                    provider.insertTokensAt(id, 0, tokens);
 
                if (tokens != null) {  // If either an edited sequence or a pherogram URI was provided.
                    provider.insertTokensAt(id, 0, tokens);
-                   
+
                    if (pherogramProvider != null) {
                        // Create pherogram area:
                        PherogramArea pherogramArea = new PherogramArea(getReadsArea().getContentArea(),
                                new PherogramAreaModel(pherogramProvider));
                    if (pherogramProvider != null) {
                        // Create pherogram area:
                        PherogramArea pherogramArea = new PherogramArea(getReadsArea().getContentArea(),
                                new PherogramAreaModel(pherogramProvider));
-       
+
                        // Set position properties and shifts:
                        PherogramAreaModel model = pherogramArea.getModel();
                        if ((firstSeqPos != null) && (leftCutPos != null)) {
                        // Set position properties and shifts:
                        PherogramAreaModel model = pherogramArea.getModel();
                        if ((firstSeqPos != null) && (leftCutPos != null)) {