last changes for #5325
authorKatja Luther <k.luther@bgbm.org>
Wed, 28 Oct 2015 08:41:27 +0000 (09:41 +0100)
committerKatja Luther <k.luther@bgbm.org>
Wed, 28 Oct 2015 08:41:27 +0000 (09:41 +0100)
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/ChangeSynonymToAcceptedTaxonHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/MoveSynonymToAnotherAcceptedTaxonHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientClassificationService.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/ChangeAcceptedTaxonToSynonymHandler.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/RemotingChangeAcceptedTaxonToSynonymHandler.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/RemotingMoveTaxonNodeHandler.java

index d0eca25..c6a9a0c 100644 (file)
@@ -10,6 +10,7 @@
 
 package eu.etaxonomy.taxeditor.editor.name.handler;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Set;
 import java.util.UUID;
@@ -87,7 +88,8 @@ public class ChangeSynonymToAcceptedTaxonHandler extends AbstractHandler impleme
 
                TaxonNode parentNode = (TaxonNode) HibernateProxyHelper.deproxy(((TaxonEditorInput) input).getTaxonNode().getParent());
 
-               List<UUID> excludeTaxa = null;
+               List<UUID> excludeTaxa = new ArrayList<UUID>();
+               excludeTaxa.add(taxon.getUuid());
 
                TaxonNode newParentNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), editor.getConversationHolder(), "Select parent", excludeTaxa, null, ((TaxonEditorInput) input).getTaxonNode().getClassification());
 
index b2c7b64..281e83d 100644 (file)
@@ -9,6 +9,10 @@ import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.IEditorInput;
 import org.eclipse.ui.handlers.HandlerUtil;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
 import eu.etaxonomy.cdm.model.common.CdmBase;
 import eu.etaxonomy.cdm.model.taxon.Synonym;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
@@ -48,11 +52,13 @@ public class MoveSynonymToAnotherAcceptedTaxonHandler extends AbstractHandler im
                }
 
                Synonym synonym = (Synonym) selection.getFirstElement();
+               Taxon oldParent = ((TaxonEditorInput)input).getTaxon();
+               List<UUID> excludeTaxa = new ArrayList<UUID>();
+               excludeTaxa.add(oldParent.getUuid());
+                               
                TaxonNode newParentNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), editor.getConversationHolder(), "Select new accepted taxon", null, null, ((TaxonEditorInput)input).getTaxonNode().getClassification());
                if(newParentNode!=null){
-                   Taxon oldParent = ((TaxonEditorInput)input).getTaxon();
-
-                   MoveSynonymToAnotherAcceptedTaxonOperation operation = new MoveSynonymToAnotherAcceptedTaxonOperation("Change accepted Taxon of Synonym", EditorUtil.getUndoContext(),
+                  MoveSynonymToAnotherAcceptedTaxonOperation operation = new MoveSynonymToAnotherAcceptedTaxonOperation("Change accepted Taxon of Synonym", EditorUtil.getUndoContext(),
                            oldParent.getUuid(), synonym.getUuid(), newParentNode.getTaxon(), editor);
 
                    AbstractUtility.executeOperation(operation);
index f9051e8..c708ca5 100644 (file)
@@ -975,5 +975,12 @@ public class TransientClassificationService implements IClassificationService {
         return defaultService.loadWithUpdate(arg0);
     }
 
+       @Override
+       public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
+                       UUID classificationUuid, List<UUID> excludeTaxa) {
+               
+               return defaultService.getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(classificationUuid, excludeTaxa);
+       }
+
 
 }
index f79c91f..a60bd2e 100644 (file)
@@ -108,7 +108,7 @@ public class ChangeAcceptedTaxonToSynonymHandler extends DeleteHandler
                                }*/
 
                                List<UUID> excludeTaxa = new ArrayList<UUID>();
-                               excludeTaxa.add(oldAcceptedTaxonNode.getUuid());
+                               excludeTaxa.add(((TaxonNode)oldAcceptedTaxonNode).getTaxon().getUuid());
                                TaxonNode newAcceptedTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event),
                                                taxonNavigator.getConversationHolder(),
                                                "Choose the accepted taxon",
index a42c6df..c4f6df3 100644 (file)
@@ -97,7 +97,7 @@ public class RemotingChangeAcceptedTaxonToSynonymHandler extends RemotingCdmHand
     @Override
     public AbstractOperation prepareOperation(ExecutionEvent event) {
         List<UUID> excludeTaxa = new ArrayList<UUID>();
-        excludeTaxa.add(oldTaxonNode.getUuid());
+        excludeTaxa.add(((TaxonNode)oldTaxonNode).getTaxon().getUuid());
         TaxonNode newAcceptedTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event),
                 new ConversationHolderMock(),
                 "Choose the accepted taxon",
index 2882118..9152461 100644 (file)
@@ -85,7 +85,7 @@ public class RemotingMoveTaxonNodeHandler extends RemotingCdmHandler {
         TaxonNode parentTaxonNode;
 
         List<UUID> excludeTaxa = new ArrayList<UUID>();
-        excludeTaxa.add(oldTaxonNode.getUuid());
+        excludeTaxa.add(((TaxonNode)oldTaxonNode).getTaxon().getUuid());
 
         boolean moveToNewParent = true;