Revision 953c844d
Added by Alex Theys almost 12 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/CreateDescriptionElementHandler.java | ||
---|---|---|
82 | 82 |
} |
83 | 83 |
|
84 | 84 |
if (description != null) { |
85 |
|
|
86 |
Feature feature = (Feature) ((Event) event.getTrigger()).data; |
|
87 |
|
|
88 | 85 |
AbstractPostOperation operation = null; |
89 | 86 |
try { |
90 | 87 |
// TODO use undo context specific to editor |
91 |
operation = new CreateDescriptionElementOperation(event |
|
92 |
.getCommand().getName(), |
|
93 |
EditorUtil.getUndoContext(), taxon, |
|
94 |
description, feature, postOperationEnabled); |
|
88 |
operation = operationCreationInstance(event.getCommand().getName(), event, taxon, description, postOperationEnabled); |
|
95 | 89 |
EditorUtil.executeOperation(operation); |
96 | 90 |
} catch (NotDefinedException e) { |
97 | 91 |
EditorUtil.warn(getClass(), "Command name not set"); |
... | ... | |
104 | 98 |
return null; |
105 | 99 |
|
106 | 100 |
} |
101 |
|
|
102 |
/** |
|
103 |
* Added to make the Class more generic and limit the amount of code changes required |
|
104 |
* @param label |
|
105 |
* @param event |
|
106 |
* @param taxon |
|
107 |
* @param description |
|
108 |
* @param postOperationEnabled |
|
109 |
* @return |
|
110 |
*/ |
|
111 |
protected AbstractPostOperation operationCreationInstance(String label, ExecutionEvent event, Taxon taxon, TaxonDescription description, IPostOperationEnabled postOperationEnabled) { |
|
112 |
Feature feature = (Feature) ((Event) event.getTrigger()).data; |
|
113 |
return new CreateDescriptionElementOperation(label, |
|
114 |
EditorUtil.getUndoContext(), taxon, |
|
115 |
description, feature, postOperationEnabled); |
|
116 |
} |
|
117 |
|
|
107 | 118 |
} |
Also available in: Unified diff
AT: committing changes to the TaxEditor Post second round of code review