ref #7010 Adapt poly key handlers for multiple selection
authorPatrick Plitzner <p.plitzner@bgbm.org>
Tue, 5 Jun 2018 13:05:22 +0000 (15:05 +0200)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Tue, 5 Jun 2018 13:05:22 +0000 (15:05 +0200)
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/e4/handler/DeleteNodeHandlerE4.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/e4/handler/RefreshNodeNumberingHandlerE4.java

index b6cb05a6c59bb1000ff18b553c6a7e8535e8807b..641d8b2b175bedafec831d79abdc922fdad9da49 100644 (file)
@@ -148,7 +148,7 @@ public class DeleteNodeHandlerE4 extends RemotingCdmHandlerE4 {
     public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
             MHandledMenuItem menuItem){
         boolean canExecute = false;
-        canExecute = selection!=null && !selection.isEmpty();
+        canExecute = selection!=null && selection.size()==1;
         menuItem.setVisible(canExecute);
         return canExecute;
     }
index 2ecb95aaefe40a8308aa0f73804afeb90c7922bf..928ff4bd320fd9835908985f02a2f1aee45d0f5c 100644 (file)
@@ -3,6 +3,7 @@ package eu.etaxonomy.taxeditor.editor.key.polytomous.e4.handler;
 import javax.inject.Named;
 
 import org.eclipse.core.commands.operations.IUndoContext;
+import org.eclipse.e4.core.di.annotations.CanExecute;
 import org.eclipse.e4.core.di.annotations.Execute;
 import org.eclipse.e4.ui.di.UISynchronize;
 import org.eclipse.e4.ui.model.application.ui.basic.MPart;
@@ -41,4 +42,12 @@ public class RefreshNodeNumberingHandlerE4 {
         }
     }
 
+    @CanExecute
+    public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+            MHandledMenuItem menuItem){
+        boolean canExecute = false;
+        canExecute = selection!=null && selection.size()==1;
+        menuItem.setVisible(canExecute);
+        return canExecute;
+    }
 }