Revision b7fa95c6
Added by Katja Luther over 6 years ago
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/annotatedlineeditor/e4/handler/NewObjectHandlerE4.java | ||
---|---|---|
20 | 20 |
import org.eclipse.jface.window.Window; |
21 | 21 |
import org.eclipse.swt.widgets.Shell; |
22 | 22 |
|
23 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
|
23 | 24 |
import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator; |
24 | 25 |
import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorConstants; |
25 | 26 |
import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditorE4; |
... | ... | |
73 | 74 |
IEntityCreator entityCreator = bulkEditor.getEditorInput().getEntityCreator(); |
74 | 75 |
Object createdEntity = entityCreator.createEntity(key, dialog.getValue()); |
75 | 76 |
bulkEditor.getEditorInput().getModel().add(createdEntity); |
77 |
if (createdEntity instanceof CdmBase){ |
|
78 |
bulkEditor.getEditorInput().addSaveCandidate((CdmBase)createdEntity); |
|
79 |
} |
|
76 | 80 |
bulkEditor.refresh(true); |
77 | 81 |
bulkEditor.setDirty(); |
78 | 82 |
} |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorE4.java | ||
---|---|---|
9 | 9 |
|
10 | 10 |
package eu.etaxonomy.taxeditor.bulkeditor.e4; |
11 | 11 |
|
12 |
import java.util.ArrayList; |
|
13 | 12 |
import java.util.List; |
14 | 13 |
|
15 | 14 |
import javax.annotation.PostConstruct; |
... | ... | |
86 | 85 |
@Inject |
87 | 86 |
private MPart thisPart; |
88 | 87 |
|
88 |
private BulkEditorQuery lastQuery = null; |
|
89 |
|
|
89 | 90 |
@Inject |
90 | 91 |
public BulkEditorE4() { |
91 | 92 |
} |
... | ... | |
203 | 204 |
} |
204 | 205 |
|
205 | 206 |
public void save(IProgressMonitor monitor, boolean resetMerge) { |
207 |
|
|
206 | 208 |
input.saveModel(resetMerge); |
207 | 209 |
|
208 | 210 |
// commit the conversation and start a new transaction immediately |
209 | 211 |
conversation.commit(true); |
210 | 212 |
|
211 | 213 |
Object object = viewer.getInput(); |
212 |
List<CdmBase> cdmBaseList = new ArrayList<>(); |
|
213 | 214 |
List<CdmBase> saveCandidates = getEditorInput().getSaveCandidates(); |
214 |
if(saveCandidates != null && !saveCandidates.isEmpty()){ |
|
215 |
for (CdmBase item: saveCandidates) { |
|
216 |
|
|
217 |
cdmBaseList.add(item); |
|
218 |
} |
|
219 |
} |
|
220 | 215 |
|
221 | 216 |
if (!saveCandidates.isEmpty()){ |
222 | 217 |
CdmStore.getService(saveCandidates.get(0)).merge(saveCandidates, true); |
223 | 218 |
} |
224 | 219 |
dirty.setDirty(false); |
225 | 220 |
getEditorInput().resetSaveCandidates(); |
221 |
|
|
222 |
if (lastQuery != null){ |
|
223 |
performSearch(lastQuery); |
|
224 |
} |
|
226 | 225 |
viewer.refresh(); |
227 | 226 |
|
227 |
|
|
228 | 228 |
} |
229 | 229 |
|
230 | 230 |
/** {@inheritDoc} */ |
... | ... | |
246 | 246 |
// getEditorInput().dispose(); |
247 | 247 |
// getEditorInput().bind(); |
248 | 248 |
getEditorInput().performSearch(query); |
249 |
|
|
249 |
lastQuery = query; |
|
250 | 250 |
viewer.setInput(getEditorInput().getModel()); |
251 | 251 |
refresh(); |
252 | 252 |
} |
... | ... | |
337 | 337 |
return conversation; |
338 | 338 |
} |
339 | 339 |
|
340 |
/** |
|
341 |
* @return |
|
342 |
*/ |
|
343 |
public BulkEditorQuery getLastQuery() { |
|
344 |
return lastQuery; |
|
345 |
} |
|
346 |
|
|
347 |
/** |
|
348 |
* @param object |
|
349 |
*/ |
|
350 |
public void setLastQuery(BulkEditorQuery lastQuery) { |
|
351 |
this.lastQuery = lastQuery; |
|
352 |
|
|
353 |
} |
|
354 |
|
|
340 | 355 |
} |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/handler/MergeGroupHandlerE4.java | ||
---|---|---|
26 | 26 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
27 | 27 |
import eu.etaxonomy.cdm.model.reference.Reference; |
28 | 28 |
import eu.etaxonomy.cdm.strategy.merge.MergeException; |
29 |
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorQuery; |
|
29 | 30 |
import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditorE4; |
30 | 31 |
import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput; |
31 | 32 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
... | ... | |
52 | 53 |
boolean proceed = MessageDialog.openQuestion(null, |
53 | 54 |
"Save changes", "You have made changes that must be saved before this query can be executed. Would you like to proceed?"); |
54 | 55 |
if (proceed) { |
56 |
BulkEditorQuery lastQuery = editor.getLastQuery(); |
|
57 |
editor.setLastQuery(null); |
|
55 | 58 |
editor.save(new NullProgressMonitor(), false); |
59 |
editor.setLastQuery(lastQuery); |
|
56 | 60 |
} else { |
57 | 61 |
return ; |
58 | 62 |
} |
Also available in: Unified diff
ref #7136: reload objects after deduplication