Revision 0d60fc16
Added by Patrick Plitzner over 6 years ago
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/LinkWithTaxonHandlerE4.java | ||
---|---|---|
10 | 10 |
|
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; |
16 |
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; |
|
15 | 17 |
import org.eclipse.e4.ui.services.IServiceConstants; |
16 | 18 |
|
17 | 19 |
import eu.etaxonomy.taxeditor.navigation.navigator.e4.TaxonNavigatorE4; |
... | ... | |
29 | 31 |
TaxonNavigatorE4 taxonNavigator = (TaxonNavigatorE4) activePart.getObject(); |
30 | 32 |
taxonNavigator.setLinkWithTaxon(!taxonNavigator.isLinkWithTaxon()); |
31 | 33 |
} |
34 |
|
|
35 |
@CanExecute |
|
36 |
public boolean canExecute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart, |
|
37 |
MHandledMenuItem menuItem){ |
|
38 |
boolean canExecute = false; |
|
39 |
canExecute = activePart.getObject() instanceof TaxonNavigatorE4; |
|
40 |
menuItem.setVisible(canExecute); |
|
41 |
return canExecute; |
|
42 |
} |
|
32 | 43 |
} |
Also available in: Unified diff
ref #6909 Add canExecute to linkWithTaxonHandler