ref #6315: implement set secundum reference for subtree in editor
[taxeditor.git] / eu.etaxonomy.taxeditor.editor / src / main / java / eu / etaxonomy / taxeditor / editor / MultiPageTaxonEditor.java
index 4cb7f97088bbed2c9f9c7f188a483fbe11db539f..6887838ddd4b127ed75a2d088b99913fd4aacbbd 100644 (file)
@@ -23,6 +23,9 @@ import org.eclipse.ui.IEditorSite;
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.forms.editor.FormEditor;
 
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent;
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
 import eu.etaxonomy.cdm.model.common.CdmBase;
@@ -145,7 +148,10 @@ IDirtyMarkable, IPartContentHasDetails, ISecuredEditor, IPartContentHasMedia {
             // commit the conversation and start a new transaction immediately
 
             input.merge();
+            
             conversation.commit(true);
+            CdmApplicationState.getCurrentDataChangeService()
+            .fireChangeEvent(new CdmChangeEvent(Action.Update, input.getTaxonNode() , MultiPageTaxonEditor.class), true);
             monitor.worked(1);
 
             this.setDirty(false);
@@ -304,8 +310,12 @@ IDirtyMarkable, IPartContentHasDetails, ISecuredEditor, IPartContentHasMedia {
     @Override
     public void changed(Object element) {
         // setDirty(true);
-        dirty = true;
-        super.editorDirtyStateChanged();
+        // if the attribute is null then do not set the dirty flag -> hotfix for the problem that for tasks done in service methods the changes are saved automatically
+        if (element != null){
+            dirty = true;
+            super.editorDirtyStateChanged();
+        }
+
         if (element instanceof TaxonBase) {
             TaxonNameEditor page = (TaxonNameEditor) getPage(Page.NAME);
             AbstractGroupedContainer container = page.getContainer((TaxonBase) element);
@@ -557,4 +567,12 @@ IDirtyMarkable, IPartContentHasDetails, ISecuredEditor, IPartContentHasMedia {
         return true;
     }
 
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.taxeditor.model.IPartContentHasMedia#canAttachMedia()
+     */
+    @Override
+    public boolean canAttachMedia() {
+        return true;
+    }
+
 }