}
@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;
}