Revision 528d11e6
Added by Patrick Plitzner over 5 years ago
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/annotatedlineeditor/e4/handler/NewObjectHandlerE4.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; |
... | ... | |
94 | 95 |
} |
95 | 96 |
} |
96 | 97 |
} |
98 |
|
|
99 |
@CanExecute |
|
100 |
public boolean canExecute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart, |
|
101 |
MHandledMenuItem menuItem){ |
|
102 |
boolean canExecute = false; |
|
103 |
canExecute = activePart.getObject() instanceof BulkEditorE4; |
|
104 |
menuItem.setVisible(canExecute); |
|
105 |
return canExecute; |
|
106 |
} |
|
97 | 107 |
} |
Also available in: Unified diff
Add @CanExecute method to handler to avoid class cast exception