Revision 4fff2d21
Added by Katja Luther about 5 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/e4/handler/MoveDescriptionElementsHandlerE4.java | ||
---|---|---|
10 | 10 |
package eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler; |
11 | 11 |
|
12 | 12 |
import java.util.ArrayList; |
13 |
import java.util.Collection; |
|
13 | 14 |
import java.util.HashSet; |
14 | 15 |
import java.util.Iterator; |
15 | 16 |
import java.util.List; |
... | ... | |
156 | 157 |
} |
157 | 158 |
newAcceptedTaxonNodeUuid = newAcceptedTaxonNode.getUuid(); |
158 | 159 |
|
159 |
MPart targetEditor = EditorUtil.checkForChanges(targetTaxon.getUuid(), partService);
|
|
160 |
Collection<MPart> targetEditors = EditorUtil.checkForChanges(targetTaxon.getUuid(), partService);
|
|
160 | 161 |
|
161 |
if ((targetEditor != null && targetEditor.getElementId().equals("eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4")) || this.editor.isDirty()){
|
|
162 |
if (targetEditors != null || this.editor.isDirty()){
|
|
162 | 163 |
boolean proceed = MessageDialog.openQuestion(null, |
163 | 164 |
Messages.MoveDescriptionToOtherTaxonHandler_SAVE_CHANGES, Messages.MoveDescriptionToOtherTaxonHandler_SAVE_CHANGES_MESSAGE); |
164 |
if (proceed) { |
|
165 |
if (targetEditor != null){ |
|
166 |
e4WrappedPart = WorkbenchUtility.getE4WrappedPart(targetEditor); |
|
167 |
((TaxonNameEditorE4)e4WrappedPart).save(AbstractUtility.getMonitor()); |
|
165 |
if( targetEditors.iterator().hasNext() ){ |
|
166 |
MPart part = targetEditors.iterator().next(); |
|
167 |
if (proceed) { |
|
168 |
if (part != null){ |
|
169 |
if (part.getElementId().equals("eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4")){ |
|
170 |
TaxonNameEditorE4 targetEditor = (TaxonNameEditorE4) WorkbenchUtility.getE4WrappedPart(part); |
|
171 |
|
|
172 |
targetEditor.save(AbstractUtility.getMonitor()); |
|
173 |
} |
|
174 |
if (editor.isDirty()){ |
|
175 |
editor.save(AbstractUtility.getMonitor()); |
|
176 |
} |
|
177 |
} else { |
|
178 |
return; |
|
179 |
} |
|
168 | 180 |
} |
169 |
if (editor.isDirty()){ |
|
170 |
editor.save(AbstractUtility.getMonitor()); |
|
171 |
} |
|
172 |
} else { |
|
173 |
return; |
|
174 | 181 |
} |
175 | 182 |
} |
176 | 183 |
|
184 |
// if ((targetEditor != null && targetEditor.getElementId().equals("eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4")) || this.editor.isDirty()){ |
|
185 |
// boolean proceed = MessageDialog.openQuestion(null, |
|
186 |
// Messages.MoveDescriptionToOtherTaxonHandler_SAVE_CHANGES, Messages.MoveDescriptionToOtherTaxonHandler_SAVE_CHANGES_MESSAGE); |
|
187 |
// if (proceed) { |
|
188 |
// if (targetEditor != null){ |
|
189 |
// e4WrappedPart = WorkbenchUtility.getE4WrappedPart(targetEditor); |
|
190 |
// ((TaxonNameEditorE4)e4WrappedPart).save(AbstractUtility.getMonitor()); |
|
191 |
// } |
|
192 |
// if (editor.isDirty()){ |
|
193 |
// editor.save(AbstractUtility.getMonitor()); |
|
194 |
// } |
|
195 |
// } else { |
|
196 |
// return; |
|
197 |
// } |
|
198 |
// } |
|
199 |
|
|
177 | 200 |
String moveMessage = String.format(Messages.MoveDescriptionElementsHandler_ELEMENTS_MOVED, editor.getTaxon()); |
178 | 201 |
|
179 | 202 |
AbstractPostOperation operation = new MoveDescriptionElementsOperation( |
Also available in: Unified diff
fix #7428: ask for saving and update open views for subtree operations