Revision 61100aa0
Added by Patrick Plitzner about 5 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/e4/handler/MoveDescriptionToOtherTaxonHandlerE4.java | ||
---|---|---|
12 | 12 |
|
13 | 13 |
import javax.inject.Named; |
14 | 14 |
|
15 |
import org.eclipse.core.runtime.NullProgressMonitor; |
|
15 | 16 |
import org.eclipse.e4.core.di.annotations.CanExecute; |
16 | 17 |
import org.eclipse.e4.core.di.annotations.Execute; |
17 | 18 |
import org.eclipse.e4.core.di.annotations.Optional; |
... | ... | |
45 | 46 |
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; |
46 | 47 |
import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog; |
47 | 48 |
import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility; |
49 |
import eu.etaxonomy.taxeditor.workbench.part.IE4SavablePart; |
|
48 | 50 |
|
49 | 51 |
/** |
50 | 52 |
* |
... | ... | |
122 | 124 |
newAcceptedTaxonNodeUuid = newAcceptedTaxonNode.getUuid(); |
123 | 125 |
newAcceptedTaxonUuid = newAcceptedTaxonNode.getTaxon().getUuid(); |
124 | 126 |
|
125 |
Collection<MPart> targetEditors = EditorUtil.checkForChanges(newAcceptedTaxonUuid, partService); |
|
126 |
|
|
127 |
if (targetEditors != null || this.editor.isDirty()){ |
|
128 |
boolean proceed = MessageDialog.openQuestion(null, |
|
129 |
Messages.MoveDescriptionToOtherTaxonHandler_SAVE_CHANGES, Messages.MoveDescriptionToOtherTaxonHandler_SAVE_CHANGES_MESSAGE); |
|
130 |
if( targetEditors.iterator().hasNext() ){ |
|
131 |
MPart part = targetEditors.iterator().next(); |
|
132 |
if (proceed) { |
|
133 |
if (part != null){ |
|
134 |
if (part.getElementId().equals("eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4")){ |
|
135 |
TaxonNameEditorE4 targetEditor = (TaxonNameEditorE4) WorkbenchUtility.getE4WrappedPart(part); |
|
136 |
targetEditor.save(AbstractUtility.getMonitor()); |
|
137 |
} |
|
138 |
if (editor.isDirty()){ |
|
139 |
editor.save(AbstractUtility.getMonitor()); |
|
140 |
} |
|
141 |
} else { |
|
142 |
return; |
|
143 |
} |
|
144 |
} |
|
127 |
Collection<IE4SavablePart> targetEditors = EditorUtil.checkForTaxonChanges(newAcceptedTaxonUuid, partService); |
|
128 |
|
|
129 |
if (!targetEditors.isEmpty() || this.editor.isDirty()){ |
|
130 |
if(MessageDialog.openQuestion(null,Messages.MoveDescriptionToOtherTaxonHandler_SAVE_CHANGES, Messages.MoveDescriptionToOtherTaxonHandler_SAVE_CHANGES_MESSAGE)) { |
|
131 |
this.editor.save(new NullProgressMonitor()); |
|
132 |
targetEditors.forEach(editor->editor.save(new NullProgressMonitor())); |
|
133 |
return; |
|
134 |
} |
|
135 |
else{ |
|
136 |
return; |
|
145 | 137 |
} |
146 | 138 |
} |
147 | 139 |
|
Also available in: Unified diff
ref #7865 Change method signature for checking for dirty taxa editors