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