Revision 90cf660a
Added by Patrick Plitzner over 6 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/DeleteTaxonBaseHandlerE4.java | ||
---|---|---|
10 | 10 |
package eu.etaxonomy.taxeditor.editor.name.e4.handler; |
11 | 11 |
import javax.inject.Named; |
12 | 12 |
|
13 |
import org.eclipse.e4.core.di.annotations.CanExecute; |
|
13 | 14 |
import org.eclipse.e4.core.di.annotations.Execute; |
14 | 15 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
15 | 16 |
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; |
... | ... | |
28 | 29 |
import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin; |
29 | 30 |
import eu.etaxonomy.taxeditor.editor.l10n.Messages; |
30 | 31 |
import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4; |
32 |
import eu.etaxonomy.taxeditor.editor.name.handler.NameEditorMenuPropertyTester; |
|
31 | 33 |
import eu.etaxonomy.taxeditor.editor.name.operation.DeleteMisapplicationOperation; |
32 | 34 |
import eu.etaxonomy.taxeditor.editor.name.operation.DeleteSynonymOperation; |
33 | 35 |
import eu.etaxonomy.taxeditor.editor.name.operation.DeleteTaxonBaseOperation; |
... | ... | |
112 | 114 |
DeleteResultMessagingUtils.messageDialogWithDetails(result, Messages.DeleteTaxonBaseHandler_DELETE_MISAPPLIEDNAME_SUCCESSFULL_BUT_REMAINING_RELATED_OBJECTS, TaxeditorEditorPlugin.PLUGIN_ID); |
113 | 115 |
} |
114 | 116 |
} |
115 |
|
|
116 |
|
|
117 | 117 |
} |
118 | 118 |
|
119 |
@CanExecute |
|
120 |
public boolean canExecute( |
|
121 |
@Named(IServiceConstants.ACTIVE_PART)MPart activePart, |
|
122 |
@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection, |
|
123 |
MHandledMenuItem menuItem){ |
|
124 |
boolean canExecute = false; |
|
125 |
Object selectedElement = selection.getFirstElement(); |
|
126 |
canExecute = |
|
127 |
NameEditorMenuPropertyTester.isSynonym(selectedElement) |
|
128 |
|| NameEditorMenuPropertyTester.isMisapplication(selectedElement) |
|
129 |
|| NameEditorMenuPropertyTester.isRelatedConcept(selectedElement); |
|
130 |
menuItem.setVisible(canExecute); |
|
131 |
return canExecute; |
|
132 |
} |
|
133 |
|
|
119 | 134 |
@Override |
120 | 135 |
public boolean postOperation(CdmBase objectAffectedByOperation) { |
121 | 136 |
|
Also available in: Unified diff
ref #6595 Set visibility of context menu items in name editor