Fixes #2357
[taxeditor.git] / eu.etaxonomy.taxeditor.editor / src / main / java / eu / etaxonomy / taxeditor / editor / key / KeyEditor.java
index e303e0ff6299ec05972d13837cf65c13a9cd5041..74311dc3bf9f1f7ef94a639fef6d728edd0256dd 100644 (file)
@@ -22,6 +22,7 @@ import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
 import eu.etaxonomy.taxeditor.editor.EditorUtil;
 import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyGraphEditor;
 import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyListEditor;
+import eu.etaxonomy.taxeditor.model.DataChangeBridge;
 import eu.etaxonomy.taxeditor.model.IDirtyMarkableSelectionProvider;
 import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
 
@@ -39,6 +40,8 @@ public class KeyEditor extends FormEditor implements IConversationEnabled,
 
        private boolean dirty;
 
+       private KeyEditorDataChangeBehaviour dataChangeBehavior;
+
        /*
         * (non-Javadoc)
         * 
@@ -85,8 +88,11 @@ public class KeyEditor extends FormEditor implements IConversationEnabled,
         * (eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap)
         */
        @Override
-       public void update(CdmDataChangeMap arg0) {
-               // TODO Auto-generated method stub
+       public void update(CdmDataChangeMap map) {
+               if(dataChangeBehavior == null){
+                       dataChangeBehavior = new KeyEditorDataChangeBehaviour(this);
+               }
+               DataChangeBridge.handleDataChange(map, dataChangeBehavior);
        }
 
        /*
@@ -112,8 +118,8 @@ public class KeyEditor extends FormEditor implements IConversationEnabled,
        public void changed(Object element) {
                editorDirtyStateChanged();
                IEditorPart activeEditor = getActiveEditor();
-               if (activeEditor instanceof PolytomousKeyListEditor) {
-                       ((PolytomousKeyListEditor) activeEditor).changed(element);
+               if (activeEditor instanceof IDirtyMarkableSelectionProvider) {
+                       ((IDirtyMarkableSelectionProvider) activeEditor).changed(element);
                }
        }
 
@@ -183,9 +189,18 @@ public class KeyEditor extends FormEditor implements IConversationEnabled,
                        EditorUtil.error(getClass(), e);
                }
 
-               PolytomousKey key = (PolytomousKey) input.getKey();
+               
 
-               setPartName(key.getTitleCache());
+               setPartName();
+
+       }
 
+       /**
+        * 
+        */
+       public void setPartName() {
+               AbstractIdentificationEditorInput input = (AbstractIdentificationEditorInput) getEditorInput();
+               PolytomousKey key = (PolytomousKey) input.getKey();
+               setPartName(key.getTitleCache());
        }
 }