ref #7010 Adapt name editor handlers for multiple selection
[taxeditor.git] / eu.etaxonomy.taxeditor.editor / src / main / java / eu / etaxonomy / taxeditor / editor / name / e4 / handler / DeleteTaxonBaseHandlerE4.java
index 449a05f073b857eafc23c0d455a69f4239e752d3..bb2501a7e854224e92659573415af75619cf3a45 100644 (file)
@@ -151,15 +151,17 @@ public class DeleteTaxonBaseHandlerE4 implements IPostOperationEnabled {
 
     @CanExecute
     public boolean canExecute(
-            @Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+            @SuppressWarnings("unused") @Named(IServiceConstants.ACTIVE_PART)MPart activePart,
             @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
             MHandledMenuItem menuItem){
         boolean canExecute = false;
-        Object selectedElement = selection.getFirstElement();
-        canExecute =
-                NameEditorMenuPropertyTester.isSynonym(selectedElement)
-                || NameEditorMenuPropertyTester.isMisapplication(selectedElement)
-                || NameEditorMenuPropertyTester.isRelatedConcept(selectedElement);
+        if(selection.size()==1){
+            Object selectedElement = selection.getFirstElement();
+            canExecute =
+                    NameEditorMenuPropertyTester.isSynonym(selectedElement)
+                    || NameEditorMenuPropertyTester.isMisapplication(selectedElement)
+                    || NameEditorMenuPropertyTester.isRelatedConcept(selectedElement);
+        }
         menuItem.setVisible(canExecute);
         return canExecute;
     }