fixing #3793 (do not allow to turn an accepted taxon into a synonym as long the accep...
[taxeditor.git] / eu.etaxonomy.taxeditor.editor / src / main / java / eu / etaxonomy / taxeditor / editor / name / handler / ChangeAcceptedTaxonToSynonymHandler.java
index b12451058fc564976a9af67ae16065fc7970c12a..a6f7910d420ed9bce401be91824ce717dcc38b27 100644 (file)
@@ -54,6 +54,15 @@ public class ChangeAcceptedTaxonToSynonymHandler extends AbstractHandler
                                Page.NAME);
                TaxonNode oldAcceptedTaxonNode = ((TaxonEditorInput) editor.getEditorInput()).getTaxonNode();
                
+               // check if taxon has no children
+               if(oldAcceptedTaxonNode.getCountChildren() > 0) {
+                       EditorUtil.warningDialog("Prerequisite not met", this, 
+                                       "The accepted taxon must not have any childen. You need to move all childen to " +
+                                       "another taxon node in the TaxonNavigator before attempting to turn the accepted " +
+                                       "taxon into a synonym.");
+                       return null;
+               }
+               
                // Choose new accepted taxon    
                List<UUID> excludeTaxa = new ArrayList<UUID>();
                excludeTaxa.add(oldAcceptedTaxonNode.getUuid());