Revision b5b429af
Added by Patrick Plitzner over 6 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/e4/handler/CreateDescriptionElementHandlerE4.java | ||
---|---|---|
15 | 15 |
|
16 | 16 |
import org.eclipse.e4.core.di.annotations.Execute; |
17 | 17 |
import org.eclipse.e4.core.di.annotations.Optional; |
18 |
import org.eclipse.e4.ui.di.UISynchronize; |
|
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; |
... | ... | |
44 | 45 |
|
45 | 46 |
@Execute |
46 | 47 |
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart, |
47 |
@Optional@Named(IServiceConstants.ACTIVE_SELECTION) Object object, MHandledMenuItem menuItem) { |
|
48 |
@Optional@Named(IServiceConstants.ACTIVE_SELECTION) Object object, MHandledMenuItem menuItem, |
|
49 |
UISynchronize sync) { |
|
48 | 50 |
|
49 | 51 |
String commandId = menuItem.getCommand().getElementId(); |
50 | 52 |
UUID uuid = (UUID) menuItem.getTransientData().get(commandId+".feature.uuid"); |
... | ... | |
66 | 68 |
MessagingUtils.error(getClass(), new IllegalArgumentException("Could not determine the taxon description")); //$NON-NLS-1$ |
67 | 69 |
return; |
68 | 70 |
} |
69 |
AbstractPostOperation operation = operationCreationInstance(menuItem.getLocalizedLabel(), feature, description, factualDataPart); |
|
71 |
AbstractPostOperation operation = operationCreationInstance(menuItem.getLocalizedLabel(), feature, description, |
|
72 |
factualDataPart); |
|
70 | 73 |
// TODO use undo context specific to editor |
71 |
AbstractUtility.executeOperation(operation); |
|
74 |
AbstractUtility.executeOperation(operation, sync);
|
|
72 | 75 |
} |
73 | 76 |
|
74 | 77 |
/** |
... | ... | |
80 | 83 |
* @param postOperationEnabled |
81 | 84 |
* @return |
82 | 85 |
*/ |
83 |
protected AbstractPostOperation operationCreationInstance(String label, Feature feature, DescriptionBase<?> description, IPostOperationEnabled postOperationEnabled) { |
|
84 |
return new CreateDescriptionElementOperation(label, EditorUtil.getUndoContext(), description, feature, postOperationEnabled); |
|
85 |
} |
|
86 |
protected AbstractPostOperation operationCreationInstance(String label, Feature feature, |
|
87 |
DescriptionBase<?> description, IPostOperationEnabled postOperationEnabled) { |
|
88 |
return new CreateDescriptionElementOperation(label, EditorUtil.getUndoContext(), description, feature, |
|
89 |
postOperationEnabled); |
|
90 |
} |
|
86 | 91 |
|
87 | 92 |
} |
Also available in: Unified diff
ref #6925 Inject context into operations to allow sync/async execution