(no commit message)
authorKatja Luther <k.luther@bgbm.org>
Mon, 8 Dec 2014 12:11:56 +0000 (12:11 +0000)
committerKatja Luther <k.luther@bgbm.org>
Mon, 8 Dec 2014 12:11:56 +0000 (12:11 +0000)
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/dnd/NameEditorDropTargetListener.java

index d0ebdbd7d19a8db2441bc400cf02ad3056e9eed3..7952313bc41b7539f003a98a34b4894e521160bb 100644 (file)
@@ -23,6 +23,7 @@ import eu.etaxonomy.taxeditor.editor.name.operation.ChangeConceptRelationshipTyp
 import eu.etaxonomy.taxeditor.editor.name.operation.ChangeConceptToSynonymOperation;
 import eu.etaxonomy.taxeditor.editor.name.operation.ChangeHomotypicGroupOperation;
 import eu.etaxonomy.taxeditor.editor.name.operation.ChangeSynonymToMisapplicationOperation;
+import eu.etaxonomy.taxeditor.editor.name.operation.MoveSynonymToAnotherAcceptedTaxonOperation;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
 
@@ -86,6 +87,13 @@ public class NameEditorDropTargetListener extends DropTargetAdapter {
         } else {
             EditorUtil.executeOperation(operation);
         }
+        target.getEditor().getConversationHolder().commit();
+               if (!target.equals(EditorUtil.getActiveMultiPageTaxonEditor().getActiveEditor())){
+                       ((TaxonNameEditor)EditorUtil.getActiveMultiPageTaxonEditor().getActiveEditor()).redraw();
+                       ((TaxonNameEditor)EditorUtil.getActiveMultiPageTaxonEditor().getActiveEditor()).getConversationHolder().commit();
+                       
+               }
+               target.getEditor().redraw();
     }
 
     private AbstractPostOperation createOperation(TaxonBase taxonBase) {
@@ -104,9 +112,18 @@ public class NameEditorDropTargetListener extends DropTargetAdapter {
                         getEditor().getTaxon(), synonym, target);
             }
             else if(target instanceof TaxonNameEditor){
-                return new ChangeHomotypicGroupOperation("Change Homotypical Group", getEditor().getUndoContext(),
-                        getEditor().getTaxon(), synonym, null, target);
-            }
+               if (target.equals(getEditor())){
+                                       return new ChangeHomotypicGroupOperation("Change Homotypical Group", getEditor().getUndoContext(), 
+                                               getEditor().getTaxon(), synonym, null, target);
+                               } else{
+                                       getEditor().getConversationHolder().commit();
+                                       ((TaxonNameEditor) target).getConversationHolder().commit();
+                                       
+                                       return new MoveSynonymToAnotherAcceptedTaxonOperation("Change accepted Taxon", getEditor().getUndoContext(), getEditor().getTaxon().getUuid(), synonym.getUuid(), ((TaxonNameEditor) target).getTaxon(), null );
+                                       
+                               }
+                       }
+            
 
         }else if(taxonBase instanceof Taxon){
             Taxon concept = (Taxon) taxonBase;