Revision 1e91a49b
Added by Katja Luther about 6 years ago
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/handler/OpenBulkEditorHandlerE4.java | ||
---|---|---|
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
9 | 9 |
package eu.etaxonomy.taxeditor.bulkeditor.e4.handler; |
10 |
import javax.inject.Named; |
|
11 |
|
|
12 | 10 |
import org.eclipse.core.commands.ParameterizedCommand; |
13 |
import org.eclipse.e4.core.di.annotations.CanExecute; |
|
14 | 11 |
import org.eclipse.e4.core.di.annotations.Execute; |
15 | 12 |
import org.eclipse.e4.ui.model.application.MApplication; |
16 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
|
17 |
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; |
|
18 |
import org.eclipse.e4.ui.services.IServiceConstants; |
|
19 | 13 |
import org.eclipse.e4.ui.workbench.modeling.EModelService; |
20 | 14 |
import org.eclipse.e4.ui.workbench.modeling.EPartService; |
21 |
import org.eclipse.jface.viewers.StructuredSelection; |
|
22 | 15 |
|
23 | 16 |
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorUtil; |
24 | 17 |
import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorConstants; |
25 |
import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditorE4; |
|
26 | 18 |
import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput; |
27 | 19 |
import eu.etaxonomy.taxeditor.bulkeditor.input.BulkEditorInputType; |
28 | 20 |
|
... | ... | |
42 | 34 |
BulkEditorUtil.openBulkEditor(input, modelService, partService, application); |
43 | 35 |
} |
44 | 36 |
|
45 |
@CanExecute |
|
46 |
public boolean canExecute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart, |
|
47 |
MHandledMenuItem menuItem) { |
|
48 |
boolean canExecute = false; |
|
49 |
BulkEditorE4 editor = (BulkEditorE4) activePart.getObject(); |
|
50 |
StructuredSelection selection = (StructuredSelection)((BulkEditorE4)activePart.getObject()).getViewer().getSelection(); |
|
51 |
canExecute = !selection.isEmpty(); |
|
52 |
menuItem.setVisible(canExecute); |
|
53 |
return canExecute; |
|
54 | 37 |
|
55 |
} |
|
56 | 38 |
} |
Also available in: Unified diff
ref #7227:minor