handle missing parent for polytomous key generation - continue
[taxeditor.git] / eu.etaxonomy.taxeditor.editor / src / main / java / eu / etaxonomy / taxeditor / editor / descriptiveDataSet / matrix / handler / GeneratePolytomousKeyHandler.java
index ca6ca5759336e788a60ac4fe70e596469ab31126..de325d868d36c652ac6616fb61c18da7144e7065 100755 (executable)
@@ -59,20 +59,16 @@ public class GeneratePolytomousKeyHandler {
         TaxonNodeDto parentDto = CdmStore.getService(ITaxonNodeService.class).findCommonParentDto(nodeDtos);
         UUID taxonUuid = parentDto.getTaxonUuid();
         int response = 0;
-        if (parentDto == null){
-               response = MessagingUtils.confirmDialog(
-                    "Choose taxonomic scope",
-                    "There is no common parent taxon for this dataset is:\n\n"
-                            + "Do you want to choose the taxonomic scope for the polytomous key?"
-                            , "Choose taxon", "Cancel");
-               response++;
-        }else{
-               response = MessagingUtils.confirmDialog(
+        String titleCache = parentDto.getTaxonTitleCache();
+        if (parentDto.getTaxonTitleCache() == null){
+               titleCache = parentDto.getTitleCache();
+        }
+        response = MessagingUtils.confirmDialog(
                 "Choose taxonomic scope",
                 String.format("The common parent taxon of this dataset is :\n%s\n\n"
                         + "Do you want to use this as the taxonomic scope for the polytomous key?"
-                        , parentDto.getTaxonTitleCache()), "Yes", "Choose different taxon", "Cancel");
-        }
+                        , titleCache), "Yes", "Choose different taxon", "Cancel");
+        
         if(response==2){
             return;
         }