Revision 8c8ead8a
Added by Cherian Mathew over 8 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/MultiPageTaxonEditor.java | ||
---|---|---|
23 | 23 |
import org.eclipse.ui.PartInitException; |
24 | 24 |
import org.eclipse.ui.forms.editor.FormEditor; |
25 | 25 |
|
26 |
import eu.etaxonomy.cdm.api.application.CdmApplicationState; |
|
27 |
import eu.etaxonomy.cdm.api.application.CdmChangeEvent; |
|
28 | 26 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
29 | 27 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
30 | 28 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
31 | 29 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
32 | 30 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
33 | 31 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
34 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
|
35 | 32 |
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; |
36 | 33 |
import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin; |
37 | 34 |
import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor; |
... | ... | |
45 | 42 |
import eu.etaxonomy.taxeditor.model.IPartContentHasMedia; |
46 | 43 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
47 | 44 |
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; |
48 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySession; |
|
49 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled; |
|
50 | 45 |
|
51 | 46 |
/** |
52 | 47 |
* |
... | ... | |
59 | 54 |
* @version 1.0 |
60 | 55 |
*/ |
61 | 56 |
public class MultiPageTaxonEditor extends FormEditor implements |
62 |
IPartContentHasFactualData, IConversationEnabled, ICdmEntitySessionEnabled, IPostOperationEnabled,
|
|
57 |
IPartContentHasFactualData, IConversationEnabled, IPostOperationEnabled, |
|
63 | 58 |
IDirtyMarkable, IPartContentHasDetails, ISecuredEditor, IPartContentHasMedia { |
64 | 59 |
|
65 | 60 |
/** Constant <code>ID="eu.etaxonomy.taxeditor.editor.taxon"{trunked}</code> */ |
... | ... | |
67 | 62 |
|
68 | 63 |
private boolean dirty; |
69 | 64 |
|
70 |
private ICdmEntitySession cdmEntitySession; |
|
71 | 65 |
private ConversationHolder conversation; |
72 | 66 |
private IDataChangeBehavior dataChangeBehavior; |
73 | 67 |
private IUndoContext undoContext; |
... | ... | |
88 | 82 |
/** {@inheritDoc} */ |
89 | 83 |
@Override |
90 | 84 |
public void dispose() { |
91 |
if(cdmEntitySession != null) { |
|
92 |
cdmEntitySession.dispose(); |
|
93 |
} |
|
85 |
input.dispose(); |
|
94 | 86 |
conversation.unregisterForDataStoreChanges(this); |
95 | 87 |
conversation.close(); |
96 | 88 |
super.dispose(); |
... | ... | |
107 | 99 |
input = (TaxonEditorInput) getEditorInput(); |
108 | 100 |
conversation = input.getConversationHolder(); |
109 | 101 |
conversation.registerForDataStoreChanges(this); |
110 |
CdmApplicationState.getCurrentDataChangeService().register(this); |
|
102 |
|
|
111 | 103 |
try { |
112 | 104 |
addPage(Page.NAME.getIndex(), new TaxonNameEditor(this), |
113 | 105 |
getEditorInput()); |
... | ... | |
152 | 144 |
|
153 | 145 |
// commit the conversation and start a new transaction immediately |
154 | 146 |
|
155 |
input.update();
|
|
147 |
input.merge();
|
|
156 | 148 |
conversation.commit(true); |
157 | 149 |
monitor.worked(1); |
158 | 150 |
|
... | ... | |
175 | 167 |
editorPage.setDisabled(); |
176 | 168 |
} |
177 | 169 |
} |
178 |
CdmApplicationState.getCurrentDataChangeService().unregister(this); |
|
170 |
|
|
179 | 171 |
conversation.unregisterForDataStoreChanges(this); |
180 | 172 |
conversation.close(); |
181 | 173 |
setDirty(false); |
... | ... | |
258 | 250 |
} |
259 | 251 |
|
260 | 252 |
this.input = (TaxonEditorInput) input; |
261 |
cdmEntitySession = this.input.getCdmEntitySession(); |
|
253 |
|
|
262 | 254 |
|
263 | 255 |
// try { |
264 | 256 |
// // Listen for name changes, |
... | ... | |
407 | 399 |
// logger.warn("Setting focus to editor"); |
408 | 400 |
// bind the conversation |
409 | 401 |
getConversationHolder().bind(); |
410 |
if(cdmEntitySession != null) { |
|
411 |
cdmEntitySession.bind(); |
|
412 |
} |
|
402 |
input.bind(); |
|
413 | 403 |
// pass focus to the active editor page |
414 | 404 |
getActiveEditor().setFocus(); |
415 | 405 |
} |
... | ... | |
567 | 557 |
return true; |
568 | 558 |
} |
569 | 559 |
|
570 |
/* (non-Javadoc) |
|
571 |
* @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getCdmEntitySession() |
|
572 |
*/ |
|
573 |
@Override |
|
574 |
public ICdmEntitySession getCdmEntitySession() { |
|
575 |
return cdmEntitySession; |
|
576 |
} |
|
577 |
|
|
578 |
/* (non-Javadoc) |
|
579 |
* @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getRootEntities() |
|
580 |
*/ |
|
581 |
@Override |
|
582 |
public List<TaxonNode> getRootEntities() { |
|
583 |
return input.getRootEntities(); |
|
584 |
} |
|
585 |
|
|
586 |
/* (non-Javadoc) |
|
587 |
* @see eu.etaxonomy.cdm.api.application.ICdmChangeListener#onChange(eu.etaxonomy.cdm.api.application.CdmChangeEvent) |
|
588 |
*/ |
|
589 |
@Override |
|
590 |
public void onChange(CdmChangeEvent event) { |
|
591 |
// TODO Auto-generated method stub |
|
592 |
|
|
593 |
} |
|
594 | 560 |
} |
Also available in: Unified diff
Update ICdmEntitySessionEnabled to no longer extend ICdmChangeListener