import eu.etaxonomy.cdm.model.name.TaxonNameBase;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
-import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
import eu.etaxonomy.taxeditor.model.IPartContentHasMedia;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
-import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
-import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
/**
*
* @version 1.0
*/
public class MultiPageTaxonEditor extends FormEditor implements
-IPartContentHasFactualData, IConversationEnabled, ICdmEntitySessionEnabled, IPostOperationEnabled,
+IPartContentHasFactualData, IConversationEnabled, IPostOperationEnabled,
IDirtyMarkable, IPartContentHasDetails, ISecuredEditor, IPartContentHasMedia {
/** Constant <code>ID="eu.etaxonomy.taxeditor.editor.taxon"{trunked}</code> */
private boolean dirty;
- private ICdmEntitySession cdmEntitySession;
private ConversationHolder conversation;
private IDataChangeBehavior dataChangeBehavior;
private IUndoContext undoContext;
/** {@inheritDoc} */
@Override
public void dispose() {
- if(cdmEntitySession != null) {
- cdmEntitySession.dispose();
- }
+ input.dispose();
conversation.unregisterForDataStoreChanges(this);
conversation.close();
super.dispose();
input = (TaxonEditorInput) getEditorInput();
conversation = input.getConversationHolder();
conversation.registerForDataStoreChanges(this);
- cdmEntitySession.registerForDataStoreChanges(this);
+
try {
addPage(Page.NAME.getIndex(), new TaxonNameEditor(this),
getEditorInput());
// commit the conversation and start a new transaction immediately
- input.update();
+ input.merge();
conversation.commit(true);
monitor.worked(1);
editorPage.setDisabled();
}
}
- cdmEntitySession.unregisterForDataStoreChanges(this);
+
conversation.unregisterForDataStoreChanges(this);
conversation.close();
setDirty(false);
}
this.input = (TaxonEditorInput) input;
- cdmEntitySession = this.input.getCdmEntitySession();
+
// try {
// // Listen for name changes,
container.refresh();
}
}
+ //refresh part title
+ //TODO: refresh taxon node in taxon navigator
+ setPartName();
}
/* (non-Javadoc)
// logger.warn("Setting focus to editor");
// bind the conversation
getConversationHolder().bind();
- if(cdmEntitySession != null) {
- cdmEntitySession.bind();
- }
+ input.bind();
// pass focus to the active editor page
getActiveEditor().setFocus();
}
/** {@inheritDoc} */
@Override
public boolean postOperation(CdmBase objectAffectedByOperation) {
- setDirty(true);
+ setDirty(true);
for (IEditorPart editor : this.getPages()) {
if (editor instanceof IPostOperationEnabled) {
}
/* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getCdmEntitySession()
+ * @see eu.etaxonomy.taxeditor.model.IPartContentHasMedia#canAttachMedia()
*/
@Override
- public ICdmEntitySession getCdmEntitySession() {
- return cdmEntitySession;
+ public boolean canAttachMedia() {
+ return true;
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getRootEntities()
- */
- @Override
- public List<TaxonNode> getRootEntities() {
- return input.getRootEntities();
- }
}