ref #6730: fix delete of media
authorKatja Luther <k.luther@bgbm.org>
Tue, 20 Jun 2017 12:10:09 +0000 (14:10 +0200)
committerKatja Luther <k.luther@bgbm.org>
Tue, 20 Jun 2017 12:10:09 +0000 (14:10 +0200)
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/DeleteHandler.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/Messages.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages.properties
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages_de.properties
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/deleteConfigurator/DeleteMediaConfiguratorComposite.java

index b90ffdcaa5f01c478a999407339097dd0b5861f8..36671bcdf6096541a05da0b129354745f74e6af6 100644 (file)
@@ -186,7 +186,9 @@ public class DeleteHandler extends AbstractHandler {
                                                  errorMessage = "The team or person ";
                                           } else if (object instanceof Media){
                                               config = new MediaDeletionConfigurator();
+                                             
                                               Media media = HibernateProxyHelper.deproxy(object, Media.class);
+                                             ((MediaDeletionConfigurator)config).setDeleteFrom(media);
                                               DeleteConfiguratorDialog dialog;
                                                   dialog = new DeleteConfiguratorDialog(config, HandlerUtil.getActiveShell(event), CONFIRM_DELETION,  null,  "Do you really want to delete the media?", MessageDialog.WARNING, new String[] { DELETE, SKIP }, 0, true);
                                                   int result_dialog= dialog.open();
index cee09e5aa38d52c2f0e090cc2d31df3ae1037a39..c2d911df1055d7e691090cc1a827b1ab4458a9f5 100644 (file)
@@ -150,7 +150,7 @@ public class Messages extends NLS {
        public static String SupplementalDataViewPart_VIEWER_NAME;
        public static String DeleteConfiguration_media_removeFromGallery;
        public static String DeleteConfiguration_media_deleteIfUsedInTaxonDescription;
-       public static String DeleteConfiguration_media_deleteIfUsedInSpecimenDescription;
+       public static String DeleteConfiguration_media_deleteIfUsedSomeWhereElse;
        public static String DeleteConfiguration_media_delete;
        public static String NewGrantedAuthority_AlreadyInDb;
 
index f17123ae3049d6032f491b0c5f1db638fe193aec..c698ee93062c59d089994d08672989b9e74155ce 100644 (file)
@@ -138,7 +138,7 @@ PresenceAbsenceTermDetailElement_LABEL_COLOR=Color
 
 DeleteConfiguration_media_removeFromGallery=Remove the media from the image gallery but leave it in database
 DeleteConfiguration_media_deleteIfUsedInTaxonDescription=Delete also if media is used in taxon description
-DeleteConfiguration_media_deleteIfUsedInSpecimenDescription=Delete also if media is used in specimen description        
+DeleteConfiguration_media_deleteIfUsedSomeWhereElse=Delete also if media is used in somewhere else        
 DeleteConfiguration_media_delete=Remove the media from the image gallery and delete the media completely, if possible
 
 NewGrantedAuthority_AlreadyInDb=The granted authority already exists.
index b6afaef66246b3e80c656b8ea6931c9f20e68581..b6033048f1da6b6426505e1f747da0d55caf6723 100644 (file)
@@ -137,8 +137,8 @@ PresenceAbsenceTermDetailElement_COLOR_NOT_SET=Farbe konnte nicht gespeichert we
 PresenceAbsenceTermDetailElement_LABEL_COLOR=Farbe
 
 DeleteConfiguration_media_removeFromGallery=Entferne Mediendaten aus der Gallerie, aber behalte es in der Datenbank
-DeleteConfiguration_media_deleteIfUsedInTaxonDescription=Lösche die Mediendaten, auch wenn es Teil einer Taxonbeschreibung ist
-DeleteConfiguration_media_deleteIfUsedInSpecimenDescription=Lösche die Mediendaten, auch wenn es Teil einer Specimenbeschreibung ist
+DeleteConfiguration_media_deleteIfUsedInTaxonDescription=Lösche die Mediendaten, auch wenn sie Teil einer Taxonbeschreibung ist
+DeleteConfiguration_media_deleteIfUsedSomeWhereElse=Lösche die Mediendaten, auch wenn sie an anderer Stelle verwendet werden
 DeleteConfiguration_media_delete=Entferne die Mediendaten aus der Gallerie und lösche sie aus der Datenbank, wenn sie nicht anderweitig verwendet werden.
 
 NewGrantedAuthority_AlreadyInDb=Die GrantedAuthority ist bereits in der DB enthalten.
index 11522e9cbece400d8d1d1a35d7229c058b12b177..39e79c6ed9566f4d4727e15b78df6d083de7d419 100644 (file)
@@ -36,8 +36,9 @@ public class DeleteMediaConfiguratorComposite extends Composite {
     private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());
     private final MediaDeletionConfigurator configurator;
     private Button btnDelete;
-    private Button btnDeleteIfUsedInTaxonDescription;
-    private Button btnDeleteIfUsedInSpecimenDescription;
+//    private Button btnDeleteIfUsedInTaxonDescription;
+//    private Button btnDeleteIfUsedInSpecimenDescription;
+    private Button btnDeleteIfUsedInSomeWhereElse;
     private Button btnRemoveFromImageGallery;
     
     private boolean inBulkEditor;
@@ -58,20 +59,26 @@ public class DeleteMediaConfiguratorComposite extends Composite {
         setBackground(getBackground());
         
         
-        if (inBulkEditor){
-            btnDeleteIfUsedInTaxonDescription = new Button(this, SWT.CHECK);
-            btnDeleteIfUsedInTaxonDescription.setText(Messages.DeleteConfiguration_media_deleteIfUsedInTaxonDescription);
-            btnDeleteIfUsedInTaxonDescription.setEnabled(true);
-            btnDeleteIfUsedInTaxonDescription.setSelection(configurator.isDeleteIfUsedInTaxonDescription());
-            btnDeleteIfUsedInSpecimenDescription = new Button(this, SWT.CHECK);
-            btnDeleteIfUsedInSpecimenDescription.setText(Messages.DeleteConfiguration_media_deleteIfUsedInSpecimenDescription);
-            btnDeleteIfUsedInSpecimenDescription.setEnabled(true);
-            btnDeleteIfUsedInSpecimenDescription.setSelection(configurator.isDeleteIfUsedInSpecimenDescription());
-        }
-        else {
+//        if (inBulkEditor){
+//            btnDeleteIfUsedInTaxonDescription = new Button(this, SWT.CHECK);
+//            btnDeleteIfUsedInTaxonDescription.setText(Messages.DeleteConfiguration_media_deleteIfUsedInTaxonDescription);
+//            btnDeleteIfUsedInTaxonDescription.setEnabled(true);
+//            btnDeleteIfUsedInTaxonDescription.setSelection(configurator.isDeleteIfUsedInTaxonDescription());
+//            btnDeleteIfUsedInSpecimenDescription = new Button(this, SWT.CHECK);
+//            btnDeleteIfUsedInSpecimenDescription.setText(Messages.DeleteConfiguration_media_deleteIfUsedInSpecimenDescription);
+//            btnDeleteIfUsedInSpecimenDescription.setEnabled(true);
+//            btnDeleteIfUsedInSpecimenDescription.setSelection(configurator.isDeleteIfUsedInSpecimenDescription());
+//        }
+//        else {
                
                btnDelete = new Button(this, SWT.RADIO);
                btnDelete.setText(Messages.DeleteConfiguration_media_delete);
+               //btnDelete.setSelection(configurator.setDeleteFrom(deleteFrom););
+               
+               btnDeleteIfUsedInSomeWhereElse = new Button(this, SWT.RADIO);
+               btnDeleteIfUsedInSomeWhereElse.setText(Messages.DeleteConfiguration_media_deleteIfUsedSomeWhereElse);
+               btnDeleteIfUsedInSomeWhereElse.setEnabled(true);
+               btnDeleteIfUsedInSomeWhereElse.setSelection(configurator.isDeleteFromEveryWhere());
                
 //            btnDeleteIfUsedInSpecimenDescription = new Button(this, SWT.CHECK);
 //            btnDeleteIfUsedInSpecimenDescription.setText(Messages.DeleteConfiguration_media_deleteIfUsedInSpecimenDescription);
@@ -85,8 +92,8 @@ public class DeleteMediaConfiguratorComposite extends Composite {
             btnRemoveFromImageGallery = new Button(this, SWT.RADIO);
             btnRemoveFromImageGallery.setText(Messages.DeleteConfiguration_media_removeFromGallery);
             btnRemoveFromImageGallery.setSelection(configurator.isOnlyRemoveFromGallery());
-               btnDelete.setSelection(configurator.isDeleteIfUsedInTaxonDescription());
-        }
+               
+//        }
 
         m_bindingContext = initDataBindings();
 
@@ -95,24 +102,27 @@ public class DeleteMediaConfiguratorComposite extends Composite {
     protected DataBindingContext initDataBindings() {
         DataBindingContext bindingContext = new DataBindingContext();
         //
-        if (inBulkEditor){
-               IObservableValue observeSelectionBtnDeleteIfUsedInTaxonDescription = WidgetProperties.selection().observe(btnDeleteIfUsedInTaxonDescription);
-               IObservableValue deleteIfUsedInTaxonDescriptionConfiguratorObserveValue = PojoProperties.value("deleteIfUsedInTaxonDescription").observe(configurator);
-               bindingContext.bindValue(observeSelectionBtnDeleteIfUsedInTaxonDescription, deleteIfUsedInTaxonDescriptionConfiguratorObserveValue, null, null);
-               
-               IObservableValue observeSelectionBtnDeleteIfUsedInSpecimenDescription = WidgetProperties.selection().observe(btnDeleteIfUsedInSpecimenDescription);
-               IObservableValue deleteIfUsedInSpecimenDescriptionConfiguratorObserveValue = PojoProperties.value("deleteIfUsedInSpecimenDescription").observe(configurator);
-               bindingContext.bindValue(observeSelectionBtnDeleteIfUsedInSpecimenDescription, deleteIfUsedInSpecimenDescriptionConfiguratorObserveValue, null, null);
-        } else{       
-        
-               IObservableValue observeSelectionBtnDelete = WidgetProperties.selection().observe(btnDelete);
-               IObservableValue deleteConfiguratorObserveValue = PojoProperties.value("deleteIfUsedInTaxonDescription").observe(configurator);
-               bindingContext.bindValue(observeSelectionBtnDelete, deleteConfiguratorObserveValue, null, null);
+//        if (inBulkEditor){
+//             IObservableValue observeSelectionBtnDeleteIfUsedInTaxonDescription = WidgetProperties.selection().observe(btnDeleteIfUsedInTaxonDescription);
+//             IObservableValue deleteIfUsedInTaxonDescriptionConfiguratorObserveValue = PojoProperties.value("deleteIfUsedInTaxonDescription").observe(configurator);
+//             bindingContext.bindValue(observeSelectionBtnDeleteIfUsedInTaxonDescription, deleteIfUsedInTaxonDescriptionConfiguratorObserveValue, null, null);
+//             
+//             IObservableValue observeSelectionBtnDeleteIfUsedInSpecimenDescription = WidgetProperties.selection().observe(btnDeleteIfUsedInSpecimenDescription);
+//             IObservableValue deleteIfUsedInSpecimenDescriptionConfiguratorObserveValue = PojoProperties.value("deleteIfUsedInSpecimenDescription").observe(configurator);
+//             bindingContext.bindValue(observeSelectionBtnDeleteIfUsedInSpecimenDescription, deleteIfUsedInSpecimenDescriptionConfiguratorObserveValue, null, null);
+//        } else{       
+               IObservableValue observeSelectionBtnDeleteIfUsedInSomeWhereElse = WidgetProperties.selection().observe(btnDeleteIfUsedInSomeWhereElse);
+               IObservableValue deleteIfUsedInSomeWhereElseConfiguratorObserveValue = PojoProperties.value("deleteFromEveryWhere").observe(configurator);
+               bindingContext.bindValue(observeSelectionBtnDeleteIfUsedInSomeWhereElse, deleteIfUsedInSomeWhereElseConfiguratorObserveValue, null, null);
+               
+//             IObservableValue observeSelectionBtnDelete = WidgetProperties.selection().observe(btnDelete);
+//             IObservableValue deleteConfiguratorObserveValue = PojoProperties.value("deleteIfUsedInTaxonDescription").observe(configurator);
+//             bindingContext.bindValue(observeSelectionBtnDelete, deleteConfiguratorObserveValue, null, null);
        
             IObservableValue observeSelectionBtnRemoveFromImageGallery = WidgetProperties.selection().observe(btnRemoveFromImageGallery);
             IObservableValue removeFromImageGalleryConfiguratorObserveValue = PojoProperties.value("onlyRemoveFromGallery").observe(configurator);
             bindingContext.bindValue(observeSelectionBtnRemoveFromImageGallery, removeFromImageGalleryConfiguratorObserveValue, null, null);
-        }
+//        }