Revision 49d3c2dd
Added by Katja Luther over 1 year ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/TaxonNameEditorE4.java | ||
---|---|---|
53 | 53 |
import org.eclipse.ui.forms.widgets.ScrolledForm; |
54 | 54 |
import org.eclipse.ui.forms.widgets.TableWrapLayout; |
55 | 55 |
|
56 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
|
57 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
|
58 | 56 |
import eu.etaxonomy.cdm.api.service.DeleteResult; |
59 | 57 |
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper; |
60 | 58 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
... | ... | |
66 | 64 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
67 | 65 |
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship; |
68 | 66 |
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto; |
69 |
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; |
|
70 | 67 |
import eu.etaxonomy.taxeditor.editor.CdmDataTransfer; |
71 | 68 |
import eu.etaxonomy.taxeditor.editor.EditorUtil; |
72 | 69 |
import eu.etaxonomy.taxeditor.editor.ISecuredEditor; |
... | ... | |
105 | 102 |
* @date Aug 24, 2017 |
106 | 103 |
*/ |
107 | 104 |
public class TaxonNameEditorE4 |
108 |
implements IConversationEnabled, IDirtyMarkable, IPartContentHasDetails,
|
|
105 |
implements IDirtyMarkable, IPartContentHasDetails, |
|
109 | 106 |
IPartContentHasSupplementalData, IPartContentHasMedia, IPartContentHasFactualData, IPartChangeListener, |
110 | 107 |
ISelectionListener, ISecuredEditor, IE4SavablePart, ITaxonEditor, IDropTargetableE4 { |
111 | 108 |
|
... | ... | |
121 | 118 |
private EPartService partService; |
122 | 119 |
private TaxonBase<?> selection; |
123 | 120 |
|
124 |
private ConversationHolder conversation; |
|
125 |
|
|
126 | 121 |
private AcceptedGroupE4 acceptedGroup; |
127 | 122 |
private List<HomotypicalSynonymGroupE4> heterotypicSynonymGroups = new ArrayList<>(); |
128 | 123 |
private MisappliedGroupE4 misappliedGroup; |
... | ... | |
256 | 251 |
// unbound |
257 | 252 |
|
258 | 253 |
eventBroker.post(WorkbenchEventConstants.CURRENT_ACTIVE_EDITOR, this); |
259 |
if (conversation != null && !conversation.isBound()) { |
|
260 |
conversation.bind(); |
|
261 |
} |
|
254 |
|
|
262 | 255 |
if (EditorUtil.isFactsVisible()){ |
263 | 256 |
EditorUtil.showFacts(modelService, partService); |
264 | 257 |
} |
... | ... | |
269 | 262 |
if (getSelectedContainer() == null) { |
270 | 263 |
throw new IllegalStateException(Messages.TaxonNameEditor_THERE_SHOULD_ALWAYS_BE); |
271 | 264 |
} |
272 |
// getSelectedContainer().setSelected(); |
|
265 |
|
|
273 | 266 |
if (input.getCdmEntitySession() != null && !input.getCdmEntitySession().isActive()) { |
274 | 267 |
input.bind(); |
275 | 268 |
} |
276 |
// if (!getSelectedContainer().isSelected()) { |
|
277 |
// getSelectedContainer().setSelected(); |
|
278 |
// } |
|
269 |
|
|
279 | 270 |
} |
280 |
// if(selection!=null){ |
|
281 |
// selService.setSelection(new StructuredSelection(selection)); |
|
282 |
// } |
|
271 |
|
|
283 | 272 |
// check permissions |
284 | 273 |
boolean doEnable = permissionsSatisfied(); |
285 | 274 |
managedForm.getForm().setEnabled(doEnable); |
... | ... | |
296 | 285 |
return doEnable; |
297 | 286 |
} |
298 | 287 |
|
299 |
@Override |
|
300 |
public ConversationHolder getConversationHolder() { |
|
301 |
return conversation; |
|
302 |
} |
|
303 |
|
|
304 |
@Override |
|
305 |
public void update(CdmDataChangeMap events) { |
|
306 |
// redraw(); |
|
307 |
} |
|
308 |
|
|
309 | 288 |
/** |
310 | 289 |
* Redraws this editor return true on success |
311 | 290 |
* |
... | ... | |
381 | 360 |
public void save(IProgressMonitor monitor) { |
382 | 361 |
|
383 | 362 |
monitor.beginTask(Messages.TaxonNameEditor_SAVING_NAMES, getGroupedContainers().size()); |
384 |
if (!conversation.isBound()) { |
|
385 |
conversation.bind(); |
|
386 |
|
|
387 |
} |
|
388 |
conversation.commit(true); |
|
389 | 363 |
monitor.worked(1); |
390 | 364 |
|
391 | 365 |
// check for empty names |
... | ... | |
413 | 387 |
} |
414 | 388 |
input.setSync(sync); |
415 | 389 |
input.merge(); |
416 |
// commit the conversation and start a new transaction immediately |
|
417 |
conversation.commit(true); |
|
418 |
|
|
390 |
|
|
419 | 391 |
dirty.setDirty(false); |
420 | 392 |
EventUtility.postEvent(WorkbenchEventConstants.REFRESH_NAVIGATOR, new TaxonNodeDto(input.getTaxonNode().getParent())); |
421 | 393 |
EventUtility.postEvent(WorkbenchEventConstants.SAVE_TAXON, true); |
... | ... | |
444 | 416 |
} |
445 | 417 |
|
446 | 418 |
this.input = input; |
447 |
conversation = input.getConversationHolder(); |
|
448 |
|
|
449 | 419 |
createOrUpdateNameComposites(true, true, true); |
450 | 420 |
|
451 | 421 |
createDragSupport(); |
... | ... | |
547 | 517 |
|
548 | 518 |
@PreDestroy |
549 | 519 |
public void dispose() { |
550 |
if (conversation != null) { |
|
551 |
conversation.unregisterForDataStoreChanges(this); |
|
552 |
conversation.close(); |
|
553 |
} |
|
554 | 520 |
if (input != null) { |
555 | 521 |
input.dispose(); |
556 | 522 |
} |
Also available in: Unified diff
ref #10186: remove conversation holder