Revision c3bb7840
Added by Patrick Plitzner over 6 years ago
eu.etaxonomy.taxeditor.navigation/META-INF/MANIFEST.MF | ||
---|---|---|
24 | 24 |
org.eclipse.e4.ui.di, |
25 | 25 |
javax.inject, |
26 | 26 |
org.eclipse.e4.ui.services, |
27 |
org.eclipse.e4.ui.workbench |
|
27 |
org.eclipse.e4.ui.workbench, |
|
28 |
org.eclipse.e4.core.di.annotations |
|
28 | 29 |
Bundle-RequiredExecutionEnvironment: JavaSE-1.8 |
29 | 30 |
Import-Package: org.eclipse.core.resources, |
30 | 31 |
org.eclipse.core.runtime, |
eu.etaxonomy.taxeditor.navigation/fragment.e4xmi | ||
---|---|---|
23 | 23 |
<children xsi:type="menu:MenuSeparator" xmi:id="_33c4IJIvEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.menuseparator.0"/> |
24 | 24 |
<children xsi:type="menu:HandledMenuItem" xmi:id="_4dTXMJIvEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.menu.new.classification" label="%command.label.3" command="_Vco-4JIxEeeJAdt8ZUxyaw"/> |
25 | 25 |
</children> |
26 |
<children xsi:type="menu:MenuSeparator" xmi:id="_24NMMJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.menuseparator.5"/> |
|
27 |
<children xsi:type="menu:DynamicMenuContribution" xmi:id="_3d1BwJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.dynamicmenucontribution.openInCdmViewer" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.view.CdmViewerContextMenuE4"/> |
|
28 |
<children xsi:type="menu:MenuSeparator" xmi:id="_h3uU0JJYEee-eM8NeuXskA" elementId="eu.etaxonomy.taxeditor.navigation.menuseparator.6"/> |
|
26 | 29 |
<children xsi:type="menu:HandledMenuItem" xmi:id="_9hdNkJIvEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.fixclassificationhierarchy" label="%command.label.fixClassificationHierarchy" command="_jXX0YJIxEeeJAdt8ZUxyaw"/> |
27 | 30 |
<children xsi:type="menu:HandledMenuItem" xmi:id="_ivOrwJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.cloneclassification" label="Clone Classification" command="_nOOxMJIxEeeJAdt8ZUxyaw"/> |
28 | 31 |
<children xsi:type="menu:MenuSeparator" xmi:id="_ktyqMJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.menuseparator.1"/> |
... | ... | |
36 | 39 |
<children xsi:type="menu:MenuSeparator" xmi:id="_x0uEMJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.menuseparator.3" visible="false"/> |
37 | 40 |
<children xsi:type="menu:HandledMenuItem" xmi:id="_yH9JQJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.delete" label="%command.label.10" command="__n644JIxEeeJAdt8ZUxyaw"/> |
38 | 41 |
<children xsi:type="menu:MenuSeparator" xmi:id="_z0Q6EJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.menuseparator.4"/> |
39 |
<children xsi:type="menu:HandledMenuItem" xmi:id="_0FX4MJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.refresh" label="%command.label.11" command="_ukhM0JIyEeeJAdt8ZUxyaw"/> |
|
42 |
<children xsi:type="menu:HandledMenuItem" xmi:id="_0FX4MJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.refresh" label="%command.label.11" command="_ukhM0JIyEeeJAdt8ZUxyaw"> |
|
43 |
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_LmLlYJJYEee-eM8NeuXskA" coreExpressionId="isCdmStoreConnected"/> |
|
44 |
</children> |
|
40 | 45 |
<children xsi:type="menu:HandledMenuItem" xmi:id="_1JIbQJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.copy" label="%command.label.12" command="_EJ-u0JIyEeeJAdt8ZUxyaw"/> |
41 |
<children xsi:type="menu:MenuSeparator" xmi:id="_24NMMJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.menuseparator.5"/> |
|
42 |
<children xsi:type="menu:DynamicMenuContribution" xmi:id="_3d1BwJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.dynamicmenucontribution.openInCdmViewer" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.view.CdmViewerContextMenuE4"/> |
|
43 | 46 |
</menus> |
44 | 47 |
</elements> |
45 | 48 |
</fragments> |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/ChangeAcceptedTaxonToSynonymHandlerE4.java | ||
---|---|---|
12 | 12 |
|
13 | 13 |
import javax.inject.Named; |
14 | 14 |
|
15 |
import org.eclipse.e4.core.di.annotations.CanExecute; |
|
15 | 16 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
16 | 17 |
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; |
17 | 18 |
import org.eclipse.e4.ui.services.IServiceConstants; |
... | ... | |
116 | 117 |
} |
117 | 118 |
} |
118 | 119 |
|
120 |
@CanExecute |
|
121 |
private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection){ |
|
122 |
return selection.getFirstElement() instanceof TaxonNode; |
|
123 |
} |
|
124 |
|
|
119 | 125 |
/** {@inheritDoc} */ |
120 | 126 |
@Override |
121 | 127 |
public boolean postOperation(CdmBase objectAffectedByOperation) { |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/CloneClassificationHandlerE4.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import javax.inject.Named; |
4 | 4 |
|
5 |
import org.eclipse.e4.core.di.annotations.CanExecute; |
|
5 | 6 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
6 | 7 |
import org.eclipse.e4.ui.services.IServiceConstants; |
7 | 8 |
import org.eclipse.jface.viewers.TreeSelection; |
... | ... | |
17 | 18 |
import eu.etaxonomy.taxeditor.navigation.l10n.Messages; |
18 | 19 |
import eu.etaxonomy.taxeditor.navigation.navigator.e4.TaxonNavigatorE4; |
19 | 20 |
import eu.etaxonomy.taxeditor.navigation.operation.CloneClassificationOperation; |
21 |
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys; |
|
22 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
|
20 | 23 |
import eu.etaxonomy.taxeditor.store.StoreUtil; |
21 | 24 |
import eu.etaxonomy.taxeditor.ui.section.classification.CloneClassificationWizard; |
22 | 25 |
|
... | ... | |
54 | 57 |
} |
55 | 58 |
} |
56 | 59 |
|
60 |
@CanExecute |
|
61 |
private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection){ |
|
62 |
return selection.getFirstElement() instanceof Classification && PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_EXPERIMENTAL_FEATURES); |
|
63 |
} |
|
57 | 64 |
} |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/CreateClassificationHierarchyHandlerE4.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import javax.inject.Named; |
4 | 4 |
|
5 |
import org.eclipse.e4.core.di.annotations.CanExecute; |
|
5 | 6 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
6 | 7 |
import org.eclipse.e4.ui.services.IServiceConstants; |
7 | 8 |
import org.eclipse.jface.viewers.TreeSelection; |
... | ... | |
13 | 14 |
import eu.etaxonomy.taxeditor.navigation.l10n.Messages; |
14 | 15 |
import eu.etaxonomy.taxeditor.navigation.navigator.e4.TaxonNavigatorE4; |
15 | 16 |
import eu.etaxonomy.taxeditor.navigation.operation.CreateNewTaxonHierarchyOperation; |
17 |
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys; |
|
18 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
|
16 | 19 |
import eu.etaxonomy.taxeditor.store.StoreUtil; |
17 | 20 |
|
18 | 21 |
/** |
... | ... | |
28 | 31 |
|
29 | 32 |
TaxonNavigatorE4 taxonNavigator = (TaxonNavigatorE4) activePart.getObject(); |
30 | 33 |
|
31 |
Object selectedElement = selection.getFirstElement(); |
|
32 |
if (selectedElement instanceof TaxonNode && !((TaxonNode)selectedElement).hasTaxon()) { |
|
33 |
Classification classification = ((TaxonNode) selectedElement).getClassification(); |
|
34 |
try { |
|
35 |
CreateNewTaxonHierarchyOperation operation = new CreateNewTaxonHierarchyOperation(Messages.CreateClassificationHierarchyHandler_CREATE_HIERARCHY, StoreUtil.getUndoContext(),classification, taxonNavigator, taxonNavigator); |
|
36 |
AbstractUtility.executeOperation(operation); |
|
37 |
taxonNavigator.refresh(); |
|
38 |
} catch (Exception e) { |
|
39 |
MessagingUtils.messageDialog(Messages.CreateClassificationHierarchyHandler_FAILED, CreateClassificationHierarchyHandlerE4.class, |
|
40 |
Messages.CreateClassificationHierarchyHandler_FAILED_MESSAGE, e); |
|
41 |
} |
|
34 |
Object selectedElement = selection.getFirstElement(); |
|
35 |
if (selectedElement instanceof TaxonNode && !((TaxonNode)selectedElement).hasTaxon()) { |
|
36 |
Classification classification = ((TaxonNode) selectedElement).getClassification(); |
|
37 |
try { |
|
38 |
CreateNewTaxonHierarchyOperation operation = new CreateNewTaxonHierarchyOperation(Messages.CreateClassificationHierarchyHandler_CREATE_HIERARCHY, StoreUtil.getUndoContext(),classification, taxonNavigator, taxonNavigator); |
|
39 |
AbstractUtility.executeOperation(operation); |
|
40 |
taxonNavigator.refresh(); |
|
41 |
} catch (Exception e) { |
|
42 |
MessagingUtils.messageDialog(Messages.CreateClassificationHierarchyHandler_FAILED, CreateClassificationHierarchyHandlerE4.class, |
|
43 |
Messages.CreateClassificationHierarchyHandler_FAILED_MESSAGE, e); |
|
42 | 44 |
} |
45 |
} |
|
43 | 46 |
} |
47 |
|
|
48 |
@CanExecute |
|
49 |
private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection){ |
|
50 |
return selection.getFirstElement() instanceof Classification && PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_EXPERIMENTAL_FEATURES); |
|
51 |
} |
|
52 |
|
|
44 | 53 |
} |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/DeleteHandlerE4.java | ||
---|---|---|
15 | 15 |
|
16 | 16 |
import javax.inject.Named; |
17 | 17 |
|
18 |
import org.eclipse.e4.core.di.annotations.CanExecute; |
|
18 | 19 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
19 | 20 |
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; |
20 | 21 |
import org.eclipse.e4.ui.services.IServiceConstants; |
... | ... | |
27 | 28 |
import eu.etaxonomy.cdm.api.service.config.TaxonNodeDeletionConfigurator; |
28 | 29 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
29 | 30 |
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode; |
31 |
import eu.etaxonomy.cdm.model.taxon.Synonym; |
|
30 | 32 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
31 | 33 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
32 | 34 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
... | ... | |
178 | 180 |
return; |
179 | 181 |
} |
180 | 182 |
|
183 |
@CanExecute |
|
184 |
private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection){ |
|
185 |
return !selection.isEmpty() && !(selection.getFirstElement() instanceof Synonym); |
|
186 |
} |
|
187 |
|
|
181 | 188 |
protected boolean closeObsoleteEditor(TaxonNode taxonNode){ |
182 | 189 |
//FIXME E4 migrate |
183 | 190 |
boolean result = true; |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/MoveFactualDataHandlerE4.java | ||
---|---|---|
6 | 6 |
|
7 | 7 |
import javax.inject.Named; |
8 | 8 |
|
9 |
import org.eclipse.e4.core.di.annotations.CanExecute; |
|
9 | 10 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
10 | 11 |
import org.eclipse.e4.ui.services.IServiceConstants; |
11 | 12 |
import org.eclipse.jface.dialogs.MessageDialog; |
... | ... | |
97 | 98 |
} |
98 | 99 |
} |
99 | 100 |
|
101 |
@CanExecute |
|
102 |
private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection){ |
|
103 |
return selection.getFirstElement() instanceof TaxonNode; |
|
104 |
} |
|
105 |
|
|
100 | 106 |
} |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/MoveTaxonHandlerE4.java | ||
---|---|---|
18 | 18 |
|
19 | 19 |
import javax.inject.Named; |
20 | 20 |
|
21 |
import org.eclipse.e4.core.di.annotations.CanExecute; |
|
21 | 22 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
22 | 23 |
import org.eclipse.e4.ui.services.IServiceConstants; |
23 | 24 |
import org.eclipse.jface.dialogs.MessageDialog; |
... | ... | |
99 | 100 |
} |
100 | 101 |
} |
101 | 102 |
|
103 |
@CanExecute |
|
104 |
private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection){ |
|
105 |
return selection.getFirstElement() instanceof TaxonNode; |
|
106 |
} |
|
107 |
|
|
102 | 108 |
/** {@inheritDoc} */ |
103 | 109 |
@Override |
104 | 110 |
public boolean postOperation(CdmBase objectAffectedByOperation) { |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/NewTaxonNodeHandlerE4.java | ||
---|---|---|
12 | 12 |
import javax.inject.Named; |
13 | 13 |
|
14 | 14 |
import org.eclipse.core.runtime.IStatus; |
15 |
import org.eclipse.e4.core.di.annotations.CanExecute; |
|
15 | 16 |
import org.eclipse.e4.ui.services.IServiceConstants; |
17 |
import org.eclipse.jface.viewers.TreeSelection; |
|
16 | 18 |
import org.eclipse.jface.wizard.WizardDialog; |
17 | 19 |
import org.eclipse.swt.widgets.Shell; |
18 | 20 |
|
... | ... | |
50 | 52 |
} |
51 | 53 |
} |
52 | 54 |
} |
55 |
|
|
56 |
@CanExecute |
|
57 |
private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection){ |
|
58 |
return selection!=null && !selection.isEmpty(); |
|
59 |
} |
|
53 | 60 |
} |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/RefreshTreeHandlerE4.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.ui.model.application.ui.basic.MPart; |
15 | 16 |
import org.eclipse.e4.ui.services.IServiceConstants; |
17 |
import org.eclipse.jface.viewers.TreeSelection; |
|
16 | 18 |
|
19 |
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode; |
|
17 | 20 |
import eu.etaxonomy.taxeditor.navigation.navigator.e4.TaxonNavigatorE4; |
18 | 21 |
|
19 | 22 |
/** |
... | ... | |
30 | 33 |
|
31 | 34 |
taxonNavigator.refresh(); |
32 | 35 |
} |
36 |
|
|
37 |
@CanExecute |
|
38 |
private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection){ |
|
39 |
return selection.getFirstElement() instanceof ITaxonTreeNode; |
|
40 |
} |
|
33 | 41 |
} |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/SetSecReferenceForSubtreeHandlerE4.java | ||
---|---|---|
8 | 8 |
*/ |
9 | 9 |
package eu.etaxonomy.taxeditor.navigation.navigator.e4.handler; |
10 | 10 |
|
11 |
import javax.inject.Named; |
|
12 |
|
|
11 | 13 |
import org.eclipse.core.commands.operations.AbstractOperation; |
12 | 14 |
import org.eclipse.core.runtime.IStatus; |
13 | 15 |
import org.eclipse.core.runtime.Status; |
16 |
import org.eclipse.e4.core.di.annotations.CanExecute; |
|
14 | 17 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
15 | 18 |
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; |
19 |
import org.eclipse.e4.ui.services.IServiceConstants; |
|
16 | 20 |
import org.eclipse.jface.viewers.TreeSelection; |
17 | 21 |
import org.eclipse.jface.window.Window; |
18 | 22 |
import org.eclipse.jface.wizard.WizardDialog; |
... | ... | |
91 | 95 |
}else{ |
92 | 96 |
return Status.CANCEL_STATUS; |
93 | 97 |
} |
98 |
} |
|
94 | 99 |
|
100 |
@CanExecute |
|
101 |
private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection){ |
|
102 |
return selection.getFirstElement() instanceof ITaxonTreeNode; |
|
95 | 103 |
} |
96 | 104 |
|
97 | 105 |
@Override |
Also available in: Unified diff
ref #6909 Implement menu item/handler visibility