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 5eb2f9b9118db1563ab5b2c79b29b08a0619ba7c..721ddbaa76ac6dfb4941e71725308db62fa6bd12 100644 (file)
@@ -154,9 +154,14 @@ public class TypeDesignationSection extends AbstractEntityCollectionSection<Taxo
 
        @Override
        public void removeElement(TypeDesignationBase element) {
 
        @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();
                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);
                }
                if(!element.isPersited() && entity!=null){
             entity.removeTypeDesignation(element);
                }