ref #7010 Adapt poly key handlers for multiple selection
authorPatrick Plitzner <p.plitzner@bgbm.org>
Wed, 6 Jun 2018 15:17:38 +0000 (17:17 +0200)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Wed, 13 Jun 2018 08:05:47 +0000 (10:05 +0200)
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/e4/handler/RemotingEditPolytomousKeyNodesHandlerE4.java

index 9aac4872bb19a1a91661ba4cdb2e73c2148cc715..f6fb177355b5bd1f99e30de0ca4ba564ada9f033 100644 (file)
@@ -114,10 +114,13 @@ public class RemotingEditPolytomousKeyNodesHandlerE4 {
     }
 
     @CanExecute
-    public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)Object selection,
+    public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
             MHandledMenuItem menuItem){
-        boolean canExecute = false;
-        canExecute = ((IStructuredSelection)selection).getFirstElement() instanceof PolytomousKey;
+        boolean canExecute = !selection.isEmpty();
+        Object[] array = selection.toArray();
+        for (Object object : array) {
+            canExecute &= object instanceof PolytomousKey;
+        }
         menuItem.setVisible(canExecute);
         return canExecute;
     }