Revision 90cf660a
Added by Patrick Plitzner over 6 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/ChangeToSynonymHandlerE4.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; |
... | ... | |
19 | 20 |
|
20 | 21 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
21 | 22 |
import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4; |
23 |
import eu.etaxonomy.taxeditor.editor.name.handler.NameEditorMenuPropertyTester; |
|
22 | 24 |
import eu.etaxonomy.taxeditor.editor.name.operation.ChangeConceptToSynonymOperation; |
23 | 25 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
24 | 26 |
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation; |
... | ... | |
48 | 50 |
AbstractUtility.executeOperation(operation); |
49 | 51 |
|
50 | 52 |
} |
53 |
|
|
54 |
@CanExecute |
|
55 |
public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection, |
|
56 |
MHandledMenuItem menuItem){ |
|
57 |
boolean canExecute = false; |
|
58 |
Object selectedElement = selection.getFirstElement(); |
|
59 |
canExecute = |
|
60 |
!NameEditorMenuPropertyTester.isAccepted(selectedElement) |
|
61 |
&& !NameEditorMenuPropertyTester.isSynonym(selectedElement); |
|
62 |
menuItem.setVisible(canExecute); |
|
63 |
return canExecute; |
|
64 |
} |
|
65 |
|
|
51 | 66 |
} |
Also available in: Unified diff
ref #6595 Set visibility of context menu items in name editor