Merge branch 'develop' of ssh://dev.e-taxonomy.eu/var/git/taxeditor into develop
authorKatja Luther <k.luther@bgbm.org>
Thu, 16 Jul 2015 12:11:39 +0000 (14:11 +0200)
committerKatja Luther <k.luther@bgbm.org>
Thu, 16 Jul 2015 12:11:39 +0000 (14:11 +0200)
eu.etaxonomy.taxeditor.bulkeditor/OSGI-INF/l10n/bundle.properties
eu.etaxonomy.taxeditor.bulkeditor/OSGI-INF/l10n/bundle_de.properties
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/ConvertPerson2TeamHandler.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/DeleteHandler.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/DeleteHandler.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/ChangeAcceptedTaxonToSynonymOperation.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/deleteConfigurator/DeleteConfiguratorDialog.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/deleteConfigurator/DeleteNodeConfiguratorComposite.java [new file with mode: 0644]

index 8858bb121ccd79d440c8170cb27ea1905d011d0a..f77e70cbb39ffefe75a6f1b5ac860d7d5e888509 100644 (file)
@@ -15,7 +15,7 @@ command.label.1 = Set as Candidate(s) for Duplicate Removal
 command.label.2 = Remove as Candidate(s) for Duplicate Removal
 command.label.3 = De-Duplicate Group
 command.label.4 = Delete
-command.label.5 = Convert Team to Person
+command.label.5 = Convert to Person
 command.name = Merge Group
 command.name.0 = Set as Target for Group Merge
 command.name.1 = Dynamic Open Bulk Editor
@@ -26,9 +26,9 @@ command.name.4 = Set as Candidate for Group Merge
 command.name.5 = Remove as Candidate for Group Merge
 command.name.6 = Set Marker Flag
 command.name.7 = delete
-command.name.8 = convert Team to Person
-command.name.9 = convert Person to Team
+command.name.8 = convert to Person
+command.name.9 = convert to Team
 specification.label = Merge Candidate Annotation
 specification.label.0 = Merge Target Annotation
-command.label.6 = Convert Person to Team
+command.label.6 = Convert to Team
 command.name.10 = convert Person to Team
\ No newline at end of file
index c05c77c3cc42f8beb24491db59a09b531c96403d..1365dd13911261d9b8a7479a48d32a0e1b51fd47 100644 (file)
@@ -14,4 +14,6 @@ command.label.0 = Markiere Zeile als Ziel f\u00fcr Duplikatenentfernung
 command.label.1 = Markiere als Kandidat(en) f\u00fcr Duplikatenentfernung
 command.label.2 = Entferne Kandidat f\u00fcr Duplikatenentfernung
 command.label.3 = Dedupliziere Gruppe
-command.label.4 = L\u00f6schen
\ No newline at end of file
+command.label.4 = L\u00f6schen
+command.label.5 = Umwandeln in Person
+command.label.6 = Umwandeln in Team
\ No newline at end of file
index cb3a610edd667d001572a5b70e125f53384a4e97..ee587aaa601eb440f9336f4fc9c8ec959bee1d50 100644 (file)
@@ -29,6 +29,7 @@ import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService;
 import eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotation;\r
 import eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotationModel;\r
 import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;\r
+import eu.etaxonomy.taxeditor.bulkeditor.internal.TaxeditorBulkeditorPlugin;\r
 import eu.etaxonomy.taxeditor.model.MessagingUtils;\r
 import eu.etaxonomy.taxeditor.store.CdmStore;\r
 \r
@@ -79,12 +80,12 @@ public class ConvertPerson2TeamHandler extends AbstractHandler {
                                        try {\r
                                                team = CdmStore.getService(IAgentService.class).convertPerson2Team(person);\r
                                        } catch (IllegalArgumentException e) {\r
-                                               MessagingUtils.errorDialog("Can not convert Team to Person", null, e.getMessage(), null,e, true);\r
+                                               MessagingUtils.errorDialog("Can not convert Person into a Team", null, e.getLocalizedMessage(), TaxeditorBulkeditorPlugin.PLUGIN_ID,e, true);\r
                                        } catch (MergeException e) {\r
-                                               MessagingUtils.errorDialog("Can not convert Team to Person", null, e.getMessage(), null,e, true);\r
+                                               MessagingUtils.errorDialog("Can not convert Person into a Team", null, e.getMessage(), TaxeditorBulkeditorPlugin.PLUGIN_ID,e, true);\r
                                        }\r
                                }else{\r
-                                       MessagingUtils.informationDialog("Can not convert Team to Person", "convertTeam2Person can only be called on a team.");\r
+                                       MessagingUtils.informationDialog("Can not convert Person into a Team", "convert Person to Team can only be called on a person.");\r
                                }\r
                                \r
                                if (team != null){\r
index a34d7c5d1ce0f0d7cc4b40ed6a0a4357d841a6a2..041359836ef7622d6406aa264a7cd826bf50e314 100644 (file)
@@ -44,7 +44,6 @@ import eu.etaxonomy.cdm.model.common.CdmBase;
 import eu.etaxonomy.cdm.model.common.Group;
 import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
 import eu.etaxonomy.cdm.model.common.User;
-
 import eu.etaxonomy.cdm.model.name.TaxonNameBase;
 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
 import eu.etaxonomy.cdm.model.reference.Reference;
@@ -57,9 +56,8 @@ import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService;
 import eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotation;
 import eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotationModel;
 import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
+import eu.etaxonomy.taxeditor.bulkeditor.internal.TaxeditorBulkeditorPlugin;
 import eu.etaxonomy.taxeditor.bulkeditor.referencingobjects.ReferencingObjectsView;
-
-
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
@@ -158,19 +156,30 @@ public class DeleteHandler extends AbstractHandler {
                                                result = service.delete((TeamOrPersonBase)object);
                                        }
                                } catch (Exception e){
-                                       MessagingUtils.messageDialog("Exception occured. Could not delete", getClass(), e.getMessage(), null);
+                                       MessagingUtils.errorDialog("Exception occured. Delete not possible", getClass(), e.getMessage(), TaxeditorBulkeditorPlugin.PLUGIN_ID, null, true);
                                }
                                if (result.isError() || result.isAbort()){
                                        if (!result.getExceptions().isEmpty()) {
-                                               MessagingUtils.messageDialog("Could not delete", getClass(), result.getExceptions().toString(), null);
+                                               String message = null;
+                                               int i = result.getExceptions().size();
+                                               for (Exception e:result.getExceptions()){
+                                                       i--;
+                                                       message+= e.getMessage();
+                                                       if (i>0){
+                                                               message+= ", ";
+                                                       }
+                                               }
+                                               
+                                               
+                                               MessagingUtils.messageDialog("Delete not possible", getClass(), result.getExceptions().toString(), null);
                                        }else{
-                                               MessagingUtils.messageDialog("Could not delete", getClass(), "The object could not be deleted. An exception occured.", null);
+                                               MessagingUtils.messageDialog("Delete not possible", getClass(), "The object could not be deleted. An exception occured.", null);
                                                
                                        }
                                }
                                if (result.isOk() ){
                                        ((BulkEditor) editor).removeAnnotatedLine(annotation);
-                                       if(result.getUpdatedObjects().size() != 0 && !result.getExceptions().isEmpty()){
+                                       if(result.getUpdatedObjects().size() != 0 || !result.getExceptions().isEmpty()){
                                                MessagingUtils.informationDialog("Delete successfull", "The object is deleted but there are updated objects: " + result.toString());
                                        }
 
index 55df02ba26580f05fa4cc09d74df9336257d6b6e..5a8650098b30cf91fe380d90fb7f994e7be7fc87 100644 (file)
@@ -87,6 +87,7 @@ public class DeleteHandler extends AbstractHandler{
                                ITaxonTreeNode treeNode = treeNodes.iterator().next();
                                ITaxonTreeNode taxonNode =treeNode;
                                TaxonNodeDeletionConfigurator configNodes = new TaxonNodeDeletionConfigurator();
+                               //configNodes.setDeleteTaxon(false);
                                if (taxonNode instanceof Classification && taxonNode.hasChildNodes()){
                                        if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(config, HandlerUtil.getActiveShell(event), "Confirm Deletion", "Do you really want to delete the classification? The tree has children, they will be deleted, too.")){
                                                return null;
@@ -122,9 +123,10 @@ public class DeleteHandler extends AbstractHandler{
 
                                                }
                                        }else{
-                                               if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(config, HandlerUtil.getActiveShell(event), "Confirm Deletion", "Do you really want to delete the selected node?")){
+                                               if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(configNodes, HandlerUtil.getActiveShell(event), "Confirm Deletion", "Do you really want to delete the selected node?")){
                                                        return null;
-                                               }
+                                               } 
+                                               config.setTaxonNodeConfig(configNodes);
                                        }
                                }
 
index 1f17047020c0cb07cca4806cc6edb94b48364a27..b9c5e9dd38111a6106b3364f3cb6d892697ffbba 100644 (file)
@@ -86,7 +86,7 @@ public class ChangeAcceptedTaxonToSynonymOperation extends
                                
                        MessagingUtils.informationDialog("Synonym created but taxon is not deleted.", exceptionString);                 
                    } else if (result.isAbort() || result.isError()){
-                       MessagingUtils.errorDialog("Synonym could not created", null, result.toString(), null, null, true);
+                       MessagingUtils.errorDialog("Synonym could not created", null, result.toString(), TaxeditorNavigationPlugin.PLUGIN_ID, null, true);
                    }
                } catch (IllegalArgumentException e) {
             MessagingUtils.errorDialog("Operation failed", this, e.getMessage(), TaxeditorNavigationPlugin.PLUGIN_ID, e, false);
index eb36edac26f314ac4853c445ef28331754b62449..647addd10ccaea42b89725ac4b201456b51c25e5 100644 (file)
@@ -20,6 +20,7 @@ import org.eclipse.swt.widgets.Shell;
 import eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase;
 import eu.etaxonomy.cdm.api.service.config.SpecimenDeleteConfigurator;
 import eu.etaxonomy.cdm.api.service.config.TaxonBaseDeletionConfigurator;
+import eu.etaxonomy.cdm.api.service.config.TaxonNodeDeletionConfigurator;
 
 /**
  * Abstract subclass of MessageDialog providing the functionality to configure
@@ -49,7 +50,10 @@ public class DeleteConfiguratorDialog extends MessageDialog{
         }
         else if(configurator instanceof SpecimenDeleteConfigurator){
             composite.addConfiguratorComposite(new DeleteSpecimenConfiguratorComposite((SpecimenDeleteConfigurator) configurator, composite.getSectionConfigure(), SWT.NONE));
+        } else if(configurator instanceof TaxonNodeDeletionConfigurator){
+            composite.addConfiguratorComposite(new DeleteNodeConfiguratorComposite((TaxonNodeDeletionConfigurator) configurator, composite.getSectionConfigure(), SWT.NONE));
         }
+        
         return composite;
     }
 
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/deleteConfigurator/DeleteNodeConfiguratorComposite.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/deleteConfigurator/DeleteNodeConfiguratorComposite.java
new file mode 100644 (file)
index 0000000..4901526
--- /dev/null
@@ -0,0 +1,76 @@
+package eu.etaxonomy.taxeditor.ui.dialog.deleteConfigurator;
+/**
+* Copyright (C) 2015 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.beans.PojoProperties;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.jface.databinding.swt.WidgetProperties;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.layout.RowLayout;
+
+import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
+import eu.etaxonomy.cdm.api.service.config.TaxonNodeDeletionConfigurator;
+/**
+ * @author kluther
+ * @date Jul 13, 2015
+ *
+ */
+public class DeleteNodeConfiguratorComposite extends Composite {
+       // $Id$
+       
+       private final DataBindingContext m_bindingContext;
+
+       private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());
+       private final TaxonNodeDeletionConfigurator configurator;
+       private final Button btnDeleteTaxon;
+
+
+           /**
+            * Create the composite.
+            * @param parent
+            * @param style
+            */
+           public DeleteNodeConfiguratorComposite(TaxonNodeDeletionConfigurator configurator, Composite parent, int style) {
+               super(parent, style);
+               this.configurator = configurator;
+               addDisposeListener(new DisposeListener() {
+                   @Override
+                   public void widgetDisposed(DisposeEvent e) {
+                       toolkit.dispose();
+                   }
+               });
+               toolkit.paintBordersFor(this);
+               setLayout(new RowLayout(SWT.VERTICAL));
+               setBackground(getBackground());
+
+               btnDeleteTaxon = new Button(this, SWT.CHECK);
+               btnDeleteTaxon.setText("Delete taxon if possible");
+            
+               m_bindingContext = initDataBindings();
+
+           }
+
+           protected DataBindingContext initDataBindings() {
+               DataBindingContext bindingContext = new DataBindingContext();
+               //
+               IObservableValue observeSelectionBtnDeleteTaxonObserveWidget = WidgetProperties.selection().observe(btnDeleteTaxon);
+               IObservableValue deleteTaxonIfPossibleConfiguratorObserveValue = PojoProperties.value("deleteTaxon").observe(configurator);
+               bindingContext.bindValue(observeSelectionBtnDeleteTaxonObserveWidget, deleteTaxonIfPossibleConfiguratorObserveValue, null, null);
+               //
+               return bindingContext;
+           }
+       }
+
+