Revision 90cf660a
Added by Patrick Plitzner over 6 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/ChangeToMisapplicationHandlerE4.java | ||
---|---|---|
11 | 11 |
|
12 | 12 |
import javax.inject.Named; |
13 | 13 |
|
14 |
import org.eclipse.e4.core.di.annotations.CanExecute; |
|
14 | 15 |
import org.eclipse.e4.core.di.annotations.Execute; |
15 | 16 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
16 | 17 |
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; |
... | ... | |
23 | 24 |
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType; |
24 | 25 |
import eu.etaxonomy.taxeditor.editor.EditorUtil; |
25 | 26 |
import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4; |
27 |
import eu.etaxonomy.taxeditor.editor.name.handler.NameEditorMenuPropertyTester; |
|
26 | 28 |
import eu.etaxonomy.taxeditor.editor.name.operation.ChangeConceptRelationshipTypeOperation; |
27 | 29 |
import eu.etaxonomy.taxeditor.editor.name.operation.ChangeSynonymToMisapplicationOperation; |
28 | 30 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
... | ... | |
64 | 66 |
|
65 | 67 |
AbstractUtility.executeOperation(operation); |
66 | 68 |
} |
69 |
|
|
70 |
@CanExecute |
|
71 |
public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection, |
|
72 |
MHandledMenuItem menuItem){ |
|
73 |
boolean canExecute = false; |
|
74 |
Object selectedElement = selection.getFirstElement(); |
|
75 |
canExecute = |
|
76 |
!NameEditorMenuPropertyTester.isAccepted(selectedElement) |
|
77 |
&& !NameEditorMenuPropertyTester.isMisapplication(selectedElement); |
|
78 |
menuItem.setVisible(canExecute); |
|
79 |
return canExecute; |
|
80 |
} |
|
81 |
|
|
67 | 82 |
} |
Also available in: Unified diff
ref #6595 Set visibility of context menu items in name editor