import java.util.List;
import java.util.UUID;
+import javax.inject.Named;
+
import org.eclipse.core.commands.operations.AbstractOperation;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.e4.core.di.annotations.CanExecute;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.swt.widgets.Shell;
}
@Override
- public IStatus allowOperations(TreeSelection selection,
+ public IStatus allowOperations(IStructuredSelection selection,
Shell shell,
MPart activePart,
MHandledMenuItem menuItem) {
}
@Override
- public AbstractOperation prepareOperation(TreeSelection selection,
+ public AbstractOperation prepareOperation(IStructuredSelection selection,
Shell shell,
MPart activePart,
MHandledMenuItem menuItem) {
return rcattso;
}
+ @CanExecute
+ private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection, MHandledMenuItem menuItem){
+ boolean canExecute = false;
+ canExecute = selection.getFirstElement() instanceof TaxonNode
+ && ((TaxonNode) selection.getFirstElement()).getTaxon()!=null;
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+
@Override
public void onComplete() {
}