ref #8225 Fix deletion of not persisted type designations
authorPatrick Plitzner <p.plitzner@bgbm.org>
Thu, 11 Apr 2019 10:26:16 +0000 (12:26 +0200)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Thu, 11 Apr 2019 10:26:32 +0000 (12:26 +0200)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/TypeDesignationSection.java

index 5369325da08769ab36ac429bf4d4d66099104468..20676122f3a6b9d76b1e06213374e33fcb7fc562 100644 (file)
@@ -157,7 +157,10 @@ public class TypeDesignationSection extends AbstractEntityCollectionSection<Taxo
                boolean removeTypeDesignationFromAllTypifiedNames = PreferencesUtil.getBooleanValue(IPreferenceKeys.ADD_TYPES_TO_ALL_NAMES);
                TaxonName entity = removeTypeDesignationFromAllTypifiedNames ? null : getEntity();
                DetailsPartE4 detailsView = AbstractUtility.getDetailsView(getFormFactory().getContext().get((EPartService.class)));
-               if(detailsView!=null
+               if(!element.isPersited() && entity!=null){
+            entity.removeTypeDesignation(element);
+               }
+               else if(detailsView!=null
                        && detailsView.getSelectionProvidingPart().getObject() instanceof ITaxonEditor
                        && detailsView.getSelectionProvidingPart().getObject() instanceof IPostOperationEnabled) {
             DeleteTypeDesignationOperation operation = new DeleteTypeDesignationOperation(
@@ -169,9 +172,6 @@ public class TypeDesignationSection extends AbstractEntityCollectionSection<Taxo
                     null);
             ((ITaxonEditor) detailsView.getSelectionProvidingPart().getObject()).addOperation(operation);
                }
-               if(entity!=null){
-                   entity.removeTypeDesignation(element);
-               }
                updateToolbar();
        }