ref #8225 Temporary fix - ask for saving before removing a designation
authorPatrick Plitzner <p.plitzner@bgbm.org>
Thu, 11 Apr 2019 11:29:49 +0000 (13:29 +0200)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Thu, 11 Apr 2019 11:29:49 +0000 (13:29 +0200)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/TypeDesignationSection.java

index 5eb2f9b..721ddba 100644 (file)
@@ -154,9 +154,14 @@ public class TypeDesignationSection extends AbstractEntityCollectionSection<Taxo
 
        @Override
        public void removeElement(TypeDesignationBase element) {
+           DetailsPartE4 detailsView = AbstractUtility.getDetailsView(getFormFactory().getContext().get((EPartService.class)));
+           if(detailsView!=null
+                   && detailsView.getSelectionProvidingPart().getObject() instanceof IE4SavablePart
+                   && StoreUtil.promptCheckIsDirty(((IE4SavablePart)detailsView.getSelectionProvidingPart().getObject()))){
+               return;
+           }
                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(!element.isPersited() && entity!=null){
             entity.removeTypeDesignation(element);
                }