Revision 90cf660a
Added by Patrick Plitzner over 6 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/MoveSynonymToAnotherAcceptedTaxonHandlerE4.java | ||
---|---|---|
7 | 7 |
import javax.inject.Named; |
8 | 8 |
|
9 | 9 |
import org.apache.log4j.Logger; |
10 |
import org.eclipse.e4.core.di.annotations.CanExecute; |
|
10 | 11 |
import org.eclipse.e4.core.di.annotations.Execute; |
11 | 12 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
13 |
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; |
|
12 | 14 |
import org.eclipse.e4.ui.services.IServiceConstants; |
13 | 15 |
import org.eclipse.jface.viewers.IStructuredSelection; |
14 | 16 |
import org.eclipse.swt.widgets.Shell; |
... | ... | |
22 | 24 |
import eu.etaxonomy.taxeditor.editor.TaxonEditorInput; |
23 | 25 |
import eu.etaxonomy.taxeditor.editor.l10n.Messages; |
24 | 26 |
import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4; |
27 |
import eu.etaxonomy.taxeditor.editor.name.handler.NameEditorMenuPropertyTester; |
|
25 | 28 |
import eu.etaxonomy.taxeditor.editor.name.operation.MoveSynonymToAnotherAcceptedTaxonOperation; |
26 | 29 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
27 | 30 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
... | ... | |
69 | 72 |
oldParent.getUuid(), synonym.getUuid(), newParentNode.getTaxon(), editor); |
70 | 73 |
|
71 | 74 |
AbstractUtility.executeOperation(operation); |
72 |
|
|
73 | 75 |
} |
74 | 76 |
} |
75 | 77 |
|
78 |
@CanExecute |
|
79 |
public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection, |
|
80 |
MHandledMenuItem menuItem){ |
|
81 |
boolean canExecute = false; |
|
82 |
Object selectedElement = selection.getFirstElement(); |
|
83 |
canExecute = |
|
84 |
NameEditorMenuPropertyTester.isSynonym(selectedElement) |
|
85 |
&& NameEditorMenuPropertyTester.isNotHomotypicSynonymOfAcceptedTaxon(selectedElement); |
|
86 |
|
|
87 |
menuItem.setVisible(canExecute); |
|
88 |
return canExecute; |
|
89 |
} |
|
90 |
|
|
76 | 91 |
@Override |
77 | 92 |
public boolean postOperation(CdmBase objectAffectedByOperation) { |
78 |
// TODO Auto-generated method stub |
|
79 | 93 |
return false; |
80 | 94 |
} |
81 | 95 |
|
82 | 96 |
@Override |
83 | 97 |
public boolean onComplete() { |
84 |
// TODO Auto-generated method stub |
|
85 | 98 |
return false; |
86 | 99 |
} |
87 | 100 |
|
88 |
|
|
89 |
|
|
90 | 101 |
} |
Also available in: Unified diff
ref #6595 Set visibility of context menu items in name editor