Revision 41c668f3
Added by Patrick Plitzner over 6 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/EditorUtil.java | ||
---|---|---|
10 | 10 |
package eu.etaxonomy.taxeditor.editor; |
11 | 11 |
|
12 | 12 |
import java.util.Collection; |
13 |
import java.util.List; |
|
13 | 14 |
import java.util.UUID; |
14 | 15 |
|
15 | 16 |
import org.eclipse.core.commands.ExecutionEvent; |
16 | 17 |
import org.eclipse.core.commands.operations.IOperationHistory; |
17 | 18 |
import org.eclipse.core.commands.operations.IUndoContext; |
18 | 19 |
import org.eclipse.e4.ui.model.application.MApplication; |
20 |
import org.eclipse.e4.ui.model.application.ui.advanced.MArea; |
|
19 | 21 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
22 |
import org.eclipse.e4.ui.model.application.ui.basic.MPartSashContainerElement; |
|
20 | 23 |
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack; |
21 | 24 |
import org.eclipse.e4.ui.workbench.modeling.EModelService; |
22 | 25 |
import org.eclipse.e4.ui.workbench.modeling.EPartService; |
... | ... | |
27 | 30 |
import org.eclipse.jface.viewers.TreeNode; |
28 | 31 |
import org.eclipse.swt.widgets.Shell; |
29 | 32 |
import org.eclipse.ui.IEditorPart; |
33 |
import org.eclipse.ui.PartInitException; |
|
30 | 34 |
import org.eclipse.ui.handlers.HandlerUtil; |
31 | 35 |
|
32 | 36 |
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit; |
... | ... | |
69 | 73 |
// } |
70 | 74 |
// } |
71 | 75 |
|
72 |
/** |
|
73 |
* Taxon Editors may be opened by supplying a taxon node uuid. Session gets |
|
74 |
* initialised here and is passed to the editor |
|
75 |
* |
|
76 |
* @param taxonNodeUuid |
|
77 |
* a {@link java.util.UUID} object. |
|
78 |
* @throws java.lang.Exception |
|
79 |
* if any. |
|
80 |
*/ |
|
81 |
public static void openTaxonNodeE4(UUID taxonNodeUuid) throws Exception { |
|
82 |
//FIXME E4 this can probably be removed when fully migrated |
|
83 |
TaxonEditorInputE4 input = TaxonEditorInputE4.NewInstance(taxonNodeUuid); |
|
84 |
|
|
85 |
EPartService partService = TaxeditorEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getService(EPartService.class); |
|
86 |
EModelService modelService = TaxeditorEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getService(EModelService.class); |
|
87 |
openNameEditor_internal(input, modelService, partService, null); |
|
88 |
} |
|
89 | 76 |
public static void openTaxonNodeE4(UUID taxonNodeUuid, EModelService modelService, EPartService partService, MApplication application) throws Exception { |
90 | 77 |
TaxonEditorInputE4 input = TaxonEditorInputE4.NewInstance(taxonNodeUuid); |
91 | 78 |
openNameEditor_internal(input, modelService, partService, application); |
... | ... | |
134 | 121 |
} |
135 | 122 |
if(part==null){ |
136 | 123 |
part = partService.createPart(NAME_EDITOR_ID); |
137 |
if(application!=null){ |
|
138 |
//FIXME E4 hack for opening in e3 editor area
|
|
139 |
MPartStack partStack = (MPartStack)modelService.find("org.eclipse.e4.primaryDataStack", application);
|
|
140 |
partStack.getChildren().add(part);
|
|
124 |
|
|
125 |
MPartStack editorAreaPartStack = getEditorAreaPartStack(application, modelService);
|
|
126 |
if(editorAreaPartStack!=null){
|
|
127 |
editorAreaPartStack.getChildren().add(part);
|
|
141 | 128 |
} |
142 | 129 |
partService.showPart(part, PartState.ACTIVATE); |
143 | 130 |
|
... | ... | |
149 | 136 |
} |
150 | 137 |
} |
151 | 138 |
|
139 |
public static MPartStack getEditorAreaPartStack(MApplication application, EModelService modelService){ |
|
140 |
//FIXME E4 hack for opening in e3 editor area |
|
141 |
if(application!=null){ |
|
142 |
//FIXME E4 hack for opening in e3 editor area |
|
143 |
List<MArea> elements = modelService.findElements(application, "org.eclipse.ui.editorss", MArea.class, null); |
|
144 |
for (MArea mArea : elements) { |
|
145 |
List<MPartSashContainerElement> children = mArea.getChildren(); |
|
146 |
for (MPartSashContainerElement mPartSashContainerElement : children) { |
|
147 |
if(mPartSashContainerElement instanceof MPartStack){ |
|
148 |
return (MPartStack) mPartSashContainerElement; |
|
149 |
} |
|
150 |
} |
|
151 |
} |
|
152 |
} |
|
153 |
return null; |
|
154 |
} |
|
155 |
|
|
152 | 156 |
/** |
153 | 157 |
* An uninitialized taxon is one that hasn't been saved yet. As such, it |
154 | 158 |
* should appear in neither the list of recent names nor in the taxonomic |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/defaultHandler/DefaultOpenTaxonEditorForTaxonBaseHandler.java | ||
---|---|---|
20 | 20 |
|
21 | 21 |
@Override |
22 | 22 |
protected void open(TaxonBase entity, Shell shell, EPartService partService) { |
23 |
EditorUtil.openTaxonBaseE4(entity.getUuid()); |
|
23 |
EditorUtil.openTaxonBaseE4(entity.getUuid(), modelService, partService, application);
|
|
24 | 24 |
} |
25 | 25 |
|
26 | 26 |
/** |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/defaultHandler/DefaultOpenTaxonEditorForTaxonNodeHandler.java | ||
---|---|---|
23 | 23 |
@Override |
24 | 24 |
protected void open(TaxonNode entity, Shell shell, EPartService partService) { |
25 | 25 |
try { |
26 |
EditorUtil.openTaxonNodeE4(entity.getUuid()); |
|
26 |
EditorUtil.openTaxonNodeE4(entity.getUuid(), modelService, partService, application);
|
|
27 | 27 |
} catch (Exception e) { |
28 | 28 |
MessagingUtils.error(DefaultOpenTaxonEditorForTaxonNodeHandler.class, Messages.DefaultOpenTaxonEditorForTaxonNodeHandler_COULD_NOT_OPEN+entity.getTaxon(), e); |
29 | 29 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/e4/PolytomousKeyListEditorE4.java | ||
---|---|---|
17 | 17 |
import org.eclipse.core.runtime.IProgressMonitor; |
18 | 18 |
import org.eclipse.e4.ui.di.Focus; |
19 | 19 |
import org.eclipse.e4.ui.di.Persist; |
20 |
import org.eclipse.e4.ui.model.application.MApplication; |
|
20 | 21 |
import org.eclipse.e4.ui.model.application.ui.MDirtyable; |
21 | 22 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
22 | 23 |
import org.eclipse.e4.ui.services.EMenuService; |
24 |
import org.eclipse.e4.ui.workbench.modeling.EModelService; |
|
25 |
import org.eclipse.e4.ui.workbench.modeling.EPartService; |
|
23 | 26 |
import org.eclipse.e4.ui.workbench.modeling.ESelectionService; |
24 | 27 |
import org.eclipse.jface.viewers.ISelectionChangedListener; |
25 | 28 |
import org.eclipse.jface.viewers.StructuredSelection; |
... | ... | |
53 | 56 |
import eu.etaxonomy.taxeditor.model.DataChangeBridge; |
54 | 57 |
import eu.etaxonomy.taxeditor.model.IDirtyMarkable; |
55 | 58 |
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails; |
59 |
import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData; |
|
56 | 60 |
import eu.etaxonomy.taxeditor.workbench.part.IE4SavablePart; |
57 | 61 |
|
58 | 62 |
/** |
... | ... | |
98 | 102 |
if (selectedColumn == 5) { |
99 | 103 |
Taxon taxon = getItemTaxon(node); |
100 | 104 |
if (taxon != null) { |
101 |
EditorUtil.openTaxonBaseE4((taxon).getUuid()); |
|
105 |
EditorUtil.openTaxonBaseE4((taxon).getUuid(), modelService, partService, application);
|
|
102 | 106 |
} |
103 | 107 |
} |
104 | 108 |
} |
... | ... | |
146 | 150 |
@Inject |
147 | 151 |
private MDirtyable dirty; |
148 | 152 |
|
153 |
@Inject |
|
154 |
private MApplication application; |
|
155 |
|
|
156 |
@Inject |
|
157 |
private EModelService modelService; |
|
158 |
|
|
159 |
@Inject |
|
160 |
private EPartService partService; |
|
161 |
|
|
149 | 162 |
private ISelectionChangedListener selectionChangedListener; |
150 | 163 |
|
151 | 164 |
@Inject |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/ChangeSynonymToAcceptedTaxonHandlerE4.java | ||
---|---|---|
17 | 17 |
import org.eclipse.e4.core.di.annotations.CanExecute; |
18 | 18 |
import org.eclipse.e4.core.di.annotations.Execute; |
19 | 19 |
import org.eclipse.e4.ui.di.UISynchronize; |
20 |
import org.eclipse.e4.ui.model.application.MApplication; |
|
20 | 21 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
21 | 22 |
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; |
22 | 23 |
import org.eclipse.e4.ui.services.IServiceConstants; |
24 |
import org.eclipse.e4.ui.workbench.modeling.EModelService; |
|
25 |
import org.eclipse.e4.ui.workbench.modeling.EPartService; |
|
23 | 26 |
import org.eclipse.jface.viewers.IStructuredSelection; |
24 | 27 |
import org.eclipse.swt.widgets.Shell; |
25 | 28 |
import org.eclipse.ui.PartInitException; |
... | ... | |
52 | 55 |
.getLogger(ChangeSynonymToAcceptedTaxonHandlerE4.class); |
53 | 56 |
|
54 | 57 |
private TaxonNameEditorE4 editor; |
58 |
private EPartService partService; |
|
59 |
private MApplication application; |
|
60 |
private EModelService modelService; |
|
55 | 61 |
|
56 | 62 |
@Execute |
57 |
public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart, |
|
58 |
@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
|
|
59 |
@Named(IServiceConstants.ACTIVE_SHELL)Shell shell,
|
|
63 |
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart,
|
|
64 |
@Named(IServiceConstants.ACTIVE_SELECTION) IStructuredSelection selection, EPartService partService,
|
|
65 |
EModelService modelService, MApplication application, @Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
|
|
60 | 66 |
UISynchronize sync) { |
61 | 67 |
|
68 |
this.modelService = modelService; |
|
69 |
this.application = application; |
|
70 |
this.partService = partService; |
|
71 |
|
|
62 | 72 |
editor = (TaxonNameEditorE4) activePart.getObject(); |
63 | 73 |
|
64 | 74 |
TaxonEditorInputE4 input = editor.getEditorInput(); |
... | ... | |
112 | 122 |
TaxonNode newNode = (TaxonNode) objectAffectedByOperation; |
113 | 123 |
|
114 | 124 |
try { |
115 |
EditorUtil.openTaxonNodeE4(newNode.getUuid()); |
|
125 |
EditorUtil.openTaxonNodeE4(newNode.getUuid(), modelService, partService, application);
|
|
116 | 126 |
} catch (PartInitException e) { |
117 | 127 |
e.printStackTrace(); |
118 | 128 |
} catch (Exception e) { |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/SwapSynonymAndAcceptedHandlerE4.java | ||
---|---|---|
14 | 14 |
import org.eclipse.e4.core.di.annotations.CanExecute; |
15 | 15 |
import org.eclipse.e4.core.di.annotations.Execute; |
16 | 16 |
import org.eclipse.e4.ui.di.UISynchronize; |
17 |
import org.eclipse.e4.ui.model.application.MApplication; |
|
17 | 18 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
18 | 19 |
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; |
19 | 20 |
import org.eclipse.e4.ui.services.IServiceConstants; |
21 |
import org.eclipse.e4.ui.workbench.modeling.EModelService; |
|
20 | 22 |
import org.eclipse.e4.ui.workbench.modeling.EPartService; |
21 | 23 |
import org.eclipse.jface.viewers.IStructuredSelection; |
22 | 24 |
import org.eclipse.swt.widgets.Display; |
... | ... | |
46 | 48 |
private Taxon taxon; |
47 | 49 |
private EPartService partService; |
48 | 50 |
private MPart activePart; |
51 |
private MApplication application; |
|
52 |
private EModelService modelService; |
|
49 | 53 |
|
50 | 54 |
@Execute |
51 | 55 |
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart, |
52 | 56 |
@Named(IServiceConstants.ACTIVE_SELECTION) IStructuredSelection selection, |
53 | 57 |
@Named(IServiceConstants.ACTIVE_SHELL) Shell shell, MHandledMenuItem menuItem, EPartService partService, |
58 |
EModelService modelService, MApplication application, |
|
54 | 59 |
UISynchronize sync) { |
55 | 60 |
|
56 | 61 |
this.activePart = activePart; |
62 |
this.modelService = modelService; |
|
63 |
this.application = application; |
|
57 | 64 |
this.partService = partService; |
58 | 65 |
|
59 | 66 |
editor = (TaxonNameEditorE4) activePart.getObject(); |
... | ... | |
104 | 111 |
@Override |
105 | 112 |
public void run() { |
106 | 113 |
try { |
107 |
EditorUtil.openTaxonBaseE4(taxon.getUuid()); |
|
114 |
EditorUtil.openTaxonBaseE4(taxon.getUuid(), modelService, partService, application);
|
|
108 | 115 |
} catch (Exception e) { |
109 | 116 |
MessagingUtils.warningDialog(Messages.SwapSynonymAndAcceptedHandler_COULD_NOT_OPEN, this, |
110 | 117 |
e.getMessage()); |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/e4/handler/OpenRelatedConceptHandlerE4.java | ||
---|---|---|
13 | 13 |
|
14 | 14 |
import org.eclipse.e4.core.di.annotations.Execute; |
15 | 15 |
import org.eclipse.e4.core.di.annotations.Optional; |
16 |
import org.eclipse.e4.ui.model.application.MApplication; |
|
16 | 17 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
17 | 18 |
import org.eclipse.e4.ui.services.IServiceConstants; |
19 |
import org.eclipse.e4.ui.workbench.modeling.EModelService; |
|
20 |
import org.eclipse.e4.ui.workbench.modeling.EPartService; |
|
18 | 21 |
import org.eclipse.jface.viewers.ISelection; |
19 | 22 |
|
20 | 23 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
... | ... | |
39 | 42 |
|
40 | 43 |
@Execute |
41 | 44 |
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart, |
42 |
@Optional@Named(IServiceConstants.ACTIVE_SELECTION) TaxonRelationship taxonRelationship) { |
|
45 |
@Optional@Named(IServiceConstants.ACTIVE_SELECTION) TaxonRelationship taxonRelationship, EModelService modelService, EPartService partService, MApplication application) {
|
|
43 | 46 |
|
44 | 47 |
TaxonNameEditorE4 editor = null; |
45 | 48 |
BulkEditor bulkEditor = null; |
... | ... | |
72 | 75 |
String.format(Messages.OpenRelatedConceptHandler_COULD_NOT_OPEN_MESSAGE ,relatedTaxon), null); |
73 | 76 |
} |
74 | 77 |
else{ |
75 |
openConcept(relatedTaxon); |
|
78 |
openConcept(relatedTaxon, modelService, partService, application);
|
|
76 | 79 |
} |
77 | 80 |
} |
78 | 81 |
|
79 |
/** |
|
80 |
* @param relatedTaxon |
|
81 |
*/ |
|
82 |
protected void openConcept(TaxonBase<?> relatedTaxon) { |
|
83 |
EditorUtil.openTaxonBaseE4(relatedTaxon.getUuid()); |
|
82 |
protected void openConcept(TaxonBase<?> relatedTaxon, EModelService modelService, EPartService partService, MApplication application) { |
|
83 |
EditorUtil.openTaxonBaseE4(relatedTaxon.getUuid(), modelService, partService, application); |
|
84 | 84 |
} |
85 | 85 |
|
86 | 86 |
private Taxon getRelatedTaxon(TaxonRelationship relationship, Taxon taxon){ |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/e4/handler/OpenRelatedConceptInBulkEditorHandlerE4.java | ||
---|---|---|
1 | 1 |
package eu.etaxonomy.taxeditor.editor.view.concept.e4.handler; |
2 | 2 |
|
3 |
import org.eclipse.e4.ui.model.application.MApplication; |
|
4 |
import org.eclipse.e4.ui.workbench.modeling.EModelService; |
|
5 |
import org.eclipse.e4.ui.workbench.modeling.EPartService; |
|
6 |
|
|
3 | 7 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
4 | 8 |
import eu.etaxonomy.taxeditor.editor.EditorUtil; |
5 | 9 |
|
... | ... | |
8 | 12 |
* {@inheritDoc} |
9 | 13 |
*/ |
10 | 14 |
@Override |
11 |
protected void openConcept(TaxonBase<?> relatedTaxon) { |
|
12 |
EditorUtil.openTaxonBaseE4(relatedTaxon.getUuid()); |
|
15 |
protected void openConcept(TaxonBase<?> relatedTaxon, EModelService modelService, EPartService partService, MApplication application) {
|
|
16 |
EditorUtil.openTaxonBaseE4(relatedTaxon.getUuid(), modelService, partService, application);
|
|
13 | 17 |
} |
14 | 18 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/e4/handler/MoveDescriptionElementsHandlerE4.java | ||
---|---|---|
19 | 19 |
import org.eclipse.e4.core.di.annotations.Execute; |
20 | 20 |
import org.eclipse.e4.core.di.annotations.Optional; |
21 | 21 |
import org.eclipse.e4.ui.di.UISynchronize; |
22 |
import org.eclipse.e4.ui.model.application.MApplication; |
|
22 | 23 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
23 | 24 |
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; |
24 | 25 |
import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem; |
25 | 26 |
import org.eclipse.e4.ui.services.IServiceConstants; |
27 |
import org.eclipse.e4.ui.workbench.modeling.EModelService; |
|
28 |
import org.eclipse.e4.ui.workbench.modeling.EPartService; |
|
26 | 29 |
import org.eclipse.jface.viewers.ISelection; |
27 | 30 |
import org.eclipse.jface.viewers.IStructuredSelection; |
28 | 31 |
import org.eclipse.swt.widgets.Display; |
... | ... | |
62 | 65 |
public class MoveDescriptionElementsHandlerE4 implements IPostOperationEnabled{ |
63 | 66 |
private UUID newAcceptedTaxonNodeUuid; |
64 | 67 |
private TaxonNameEditorE4 editor; |
68 |
private MApplication application; |
|
69 |
private EModelService modelService; |
|
70 |
private EPartService partService; |
|
65 | 71 |
|
66 | 72 |
@Execute |
67 | 73 |
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart, |
68 |
@Optional@Named(IServiceConstants.ACTIVE_SELECTION) Object selection, |
|
69 |
@Named(IServiceConstants.ACTIVE_SHELL)Shell shell, MMenuItem menuItem, |
|
70 |
UISynchronize sync) { |
|
74 |
@Optional @Named(IServiceConstants.ACTIVE_SELECTION) Object selection, |
|
75 |
@Named(IServiceConstants.ACTIVE_SHELL) Shell shell, MMenuItem menuItem, EPartService partService, |
|
76 |
EModelService modelService, MApplication application, UISynchronize sync) { |
|
77 |
|
|
78 |
this.modelService = modelService; |
|
79 |
this.application = application; |
|
80 |
this.partService = partService; |
|
71 | 81 |
|
72 | 82 |
FactualDataPartE4 factualDataPart = (FactualDataPartE4) activePart.getObject(); |
73 | 83 |
Object e4WrappedPart = WorkbenchUtility.getE4WrappedPart(factualDataPart.getSelectionProvidingPart()); |
... | ... | |
155 | 165 |
// if(possibleOpenEditor != null){ |
156 | 166 |
// AbstractUtility.close(possibleOpenEditor); |
157 | 167 |
// } |
158 |
EditorUtil.openTaxonNodeE4(newAcceptedTaxonNodeUuid); |
|
168 |
EditorUtil.openTaxonNodeE4(newAcceptedTaxonNodeUuid, modelService, partService, application);
|
|
159 | 169 |
} catch (PartInitException e) { |
160 | 170 |
MessagingUtils.error(this.getClass(), e); |
161 | 171 |
throw new RuntimeException(e); |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/e4/handler/MoveDescriptionToOtherTaxonHandlerE4.java | ||
---|---|---|
13 | 13 |
import org.eclipse.e4.core.di.annotations.Execute; |
14 | 14 |
import org.eclipse.e4.core.di.annotations.Optional; |
15 | 15 |
import org.eclipse.e4.ui.di.UISynchronize; |
16 |
import org.eclipse.e4.ui.model.application.MApplication; |
|
16 | 17 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
17 | 18 |
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; |
18 | 19 |
import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem; |
19 | 20 |
import org.eclipse.e4.ui.services.IServiceConstants; |
21 |
import org.eclipse.e4.ui.workbench.modeling.EModelService; |
|
22 |
import org.eclipse.e4.ui.workbench.modeling.EPartService; |
|
20 | 23 |
import org.eclipse.jface.dialogs.MessageDialog; |
21 | 24 |
import org.eclipse.jface.viewers.ISelection; |
22 | 25 |
import org.eclipse.jface.viewers.IStructuredSelection; |
... | ... | |
53 | 56 |
|
54 | 57 |
private UUID newAcceptedTaxonNodeUuid; |
55 | 58 |
private TaxonNameEditorE4 editor; |
59 |
private MApplication application; |
|
60 |
private EModelService modelService; |
|
61 |
private EPartService partService; |
|
56 | 62 |
|
57 | 63 |
@Execute |
58 | 64 |
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart, |
59 |
@Optional@Named(IServiceConstants.ACTIVE_SELECTION) Object selection, |
|
60 |
@Named(IServiceConstants.ACTIVE_SHELL)Shell shell, MMenuItem menuItem,
|
|
61 |
UISynchronize sync) { |
|
65 |
@Optional @Named(IServiceConstants.ACTIVE_SELECTION) Object selection,
|
|
66 |
@Named(IServiceConstants.ACTIVE_SHELL) Shell shell, MMenuItem menuItem, EPartService partService,
|
|
67 |
EModelService modelService, MApplication application, UISynchronize sync) {
|
|
62 | 68 |
|
69 |
this.modelService = modelService; |
|
70 |
this.application = application; |
|
71 |
this.partService = partService; |
|
63 | 72 |
|
64 | 73 |
FactualDataPartE4 factualDataPart = (FactualDataPartE4) activePart.getObject(); |
65 | 74 |
Object e4WrappedPart = WorkbenchUtility.getE4WrappedPart(factualDataPart.getSelectionProvidingPart()); |
... | ... | |
141 | 150 |
// if(possibleOpenEditor != null){ |
142 | 151 |
// AbstractUtility.close(possibleOpenEditor); |
143 | 152 |
// } |
144 |
EditorUtil.openTaxonNodeE4(newAcceptedTaxonNodeUuid); |
|
153 |
EditorUtil.openTaxonNodeE4(newAcceptedTaxonNodeUuid, modelService, partService, application);
|
|
145 | 154 |
// } catch (PartInitException e) { |
146 | 155 |
// MessagingUtils.error(this.getClass(), e); |
147 | 156 |
// throw new RuntimeException(e); |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/NewTaxonNodeHandlerE4.java | ||
---|---|---|
14 | 14 |
import org.eclipse.core.runtime.IStatus; |
15 | 15 |
import org.eclipse.e4.core.di.annotations.CanExecute; |
16 | 16 |
import org.eclipse.e4.core.di.annotations.Execute; |
17 |
import org.eclipse.e4.ui.model.application.MApplication; |
|
17 | 18 |
import org.eclipse.e4.ui.services.IServiceConstants; |
19 |
import org.eclipse.e4.ui.workbench.modeling.EModelService; |
|
20 |
import org.eclipse.e4.ui.workbench.modeling.EPartService; |
|
18 | 21 |
import org.eclipse.jface.viewers.ITreeSelection; |
19 | 22 |
import org.eclipse.jface.viewers.TreeSelection; |
20 | 23 |
import org.eclipse.jface.wizard.WizardDialog; |
... | ... | |
33 | 36 |
public class NewTaxonNodeHandlerE4 { |
34 | 37 |
|
35 | 38 |
@Execute |
36 |
public void execute(@Named(IServiceConstants.ACTIVE_SHELL)Shell shell, |
|
37 |
@Named(IServiceConstants.ACTIVE_SELECTION)ITreeSelection selection) throws Exception { |
|
39 |
public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell, |
|
40 |
@Named(IServiceConstants.ACTIVE_SELECTION) ITreeSelection selection, EModelService modelService, |
|
41 |
EPartService partService, MApplication application) throws Exception { |
|
38 | 42 |
|
39 | 43 |
final NewTaxonNodeWizard wizard = new NewTaxonNodeWizard(); |
40 | 44 |
wizard.init(null, selection); |
... | ... | |
52 | 56 |
if(wizard.openEmpty()){ |
53 | 57 |
EditorUtil.openEmptyE4(wizard.getParentTreeNode().getUuid()); |
54 | 58 |
}else if(wizard.getTaxonNode() != null){ |
55 |
EditorUtil.openTaxonNodeE4(wizard.getTaxonNode().getUuid()); |
|
59 |
EditorUtil.openTaxonNodeE4(wizard.getTaxonNode().getUuid(), modelService, partService, application);
|
|
56 | 60 |
} |
57 | 61 |
} |
58 | 62 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/defaultHandler/e4/DefaultOpenHandlerBaseE4.java | ||
---|---|---|
7 | 7 |
import org.eclipse.e4.core.contexts.IEclipseContext; |
8 | 8 |
import org.eclipse.e4.core.di.annotations.CanExecute; |
9 | 9 |
import org.eclipse.e4.core.di.annotations.Execute; |
10 |
import org.eclipse.e4.ui.model.application.MApplication; |
|
10 | 11 |
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; |
11 | 12 |
import org.eclipse.e4.ui.services.IServiceConstants; |
13 |
import org.eclipse.e4.ui.workbench.modeling.EModelService; |
|
12 | 14 |
import org.eclipse.e4.ui.workbench.modeling.EPartService; |
13 | 15 |
import org.eclipse.swt.widgets.Shell; |
14 | 16 |
|
... | ... | |
16 | 18 |
|
17 | 19 |
protected IEclipseContext context; |
18 | 20 |
|
21 |
protected MApplication application; |
|
22 |
|
|
23 |
protected EModelService modelService; |
|
24 |
|
|
19 | 25 |
@Execute |
20 |
public void execute(@Named(IServiceConstants.ACTIVE_SHELL)Shell shell, MHandledMenuItem menuItem, EPartService partService, |
|
26 |
public void execute(@Named(IServiceConstants.ACTIVE_SHELL)Shell shell, MHandledMenuItem menuItem, |
|
27 |
EModelService modelService, EPartService partService, MApplication application, |
|
21 | 28 |
IEclipseContext context) { |
22 | 29 |
this.context = context; |
30 |
this.modelService = modelService; |
|
31 |
this.application = application; |
|
23 | 32 |
|
24 | 33 |
String commandId = menuItem.getCommand().getElementId(); |
25 | 34 |
Object transientData = menuItem.getTransientData().get(commandId+".uuid"); |
Also available in: Unified diff
ref #6595 code refactoring