ref #5971: new main menu admin with cdm preference nomenclatural code and insert...
[taxeditor.git] / eu.etaxonomy.taxeditor.editor / src / main / java / eu / etaxonomy / taxeditor / editor / TaxonEditorInput.java
index 7fbb22736445c6afed82ae5c2abb5d11b432da8b..782cd3da554dda7a52435064945b114108542814 100644 (file)
@@ -131,7 +131,11 @@ public class TaxonEditorInput  extends CdmEntitySessionInput implements IEditorI
             }else if(taxonBase instanceof Synonym){
                 Synonym synonym = (Synonym) taxonBase;
 
-                Set<Taxon> taxa = synonym.getAcceptedTaxa();
+                Set<Taxon> taxa = new HashSet<>();
+                Taxon taxon = synonym.getAcceptedTaxon();
+                if (taxon != null){
+                       taxa.add(taxon);
+                }
                 setInputForMultipleTaxa(conversation, taxa);
             }
         }
@@ -171,9 +175,11 @@ public class TaxonEditorInput  extends CdmEntitySessionInput implements IEditorI
             if(taxonNode != null){
                 init(taxonNode);
             }
-        }else if(taxonNodes.size() == 0){
+        } else if (taxonNodes.size() == 0) {
             // this is an undesired state
-            MessagingUtils.warningDialog("Incorrect state", TaxonEditorInput.class, "The accepted taxon is not part of any classification. This should not have happened.");
+            MessagingUtils.warningDialog("Incorrect state",TaxonEditorInput.class,"The accepted "
+                    + "taxon is not part of any classification. Editing with the "
+                    + "name editor is currently not implemented. Try to edit the taxon with the bulk editor.");
         }
     }
 
@@ -336,8 +342,8 @@ public class TaxonEditorInput  extends CdmEntitySessionInput implements IEditorI
     public boolean equals(Object obj) {
         if (TaxonEditorInput.class.equals(obj.getClass())
                 && getTaxon() != null
-                && getTaxon().equals(((TaxonEditorInput) obj).getTaxon())){
-            if(((TaxonEditorInput) obj).getInitiallySelectedTaxonBase() != null){
+                && getTaxon().equals(((TaxonEditorInput) obj).getTaxon())) {
+            if (((TaxonEditorInput) obj).getInitiallySelectedTaxonBase() != null){
                 setInitiallySelectedTaxonBase(((TaxonEditorInput) obj).getInitiallySelectedTaxonBase());
             }
             return true;
@@ -452,7 +458,8 @@ public class TaxonEditorInput  extends CdmEntitySessionInput implements IEditorI
      */
     @Override
     public void merge() {
-        CdmStore.getService(ITaxonNodeService.class).merge(taxonNode);
+       CdmStore.getService(ITaxonNodeService.class).merge(taxonNode, true);
+
     }
 
     @Override