1
|
|
2
|
package eu.etaxonomy.taxeditor.editor.descriptiveDataSet.handler;
|
3
|
|
4
|
import javax.inject.Named;
|
5
|
|
6
|
import org.eclipse.e4.core.di.annotations.CanExecute;
|
7
|
import org.eclipse.e4.core.di.annotations.Execute;
|
8
|
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
9
|
import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem;
|
10
|
import org.eclipse.e4.ui.services.IServiceConstants;
|
11
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
12
|
|
13
|
import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.DescriptiveDataSetEditor;
|
14
|
|
15
|
public class DescriptiveDataSetRemoveTaxonHandler {
|
16
|
@Execute
|
17
|
public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart) {
|
18
|
DescriptiveDataSetEditor editor = (DescriptiveDataSetEditor) activePart.getObject();
|
19
|
editor.removeSelectedTaxonNodes();
|
20
|
}
|
21
|
|
22
|
|
23
|
@CanExecute
|
24
|
public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
|
25
|
@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
|
26
|
MMenuItem menuItem) {
|
27
|
boolean canExecute = false;
|
28
|
canExecute = !selection.isEmpty() && activePart.getObject() instanceof DescriptiveDataSetEditor;
|
29
|
menuItem.setVisible(canExecute);
|
30
|
return canExecute;
|
31
|
}
|
32
|
|
33
|
}
|