import javax.inject.Named;
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.core.di.annotations.Execute;
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.TreeSelection;
+import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
import eu.etaxonomy.taxeditor.navigation.navigator.e4.TaxonNavigatorE4;
/**
*/
public class RefreshTreeHandlerE4 {
+ @Execute
public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart) {
TaxonNavigatorE4 taxonNavigator = (TaxonNavigatorE4) activePart.getObject();
taxonNavigator.refresh();
}
+
+ @CanExecute
+ private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection, MHandledMenuItem menuItem){
+ boolean canExecute = false;
+ canExecute = selection.getFirstElement() instanceof TaxonNodeDto;
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
}