}else{
SynonymDeletionConfigurator config = new SynonymDeletionConfigurator();
-
+ DeleteConfiguratorDialog dialog = new DeleteConfiguratorDialog(config, HandlerUtil.getActiveShell(event), "Confirm Deletion", null, "Do you really want to delete the synonym?", MessageDialog.WARNING, new String[] { "Delete", "Skip" }, 0);
+ int result_dialog= dialog.open();
+ if (result_dialog == 1){
+ return null;
+ }
result = service.deleteSynonym(((Synonym)object).getUuid(), config);
errorMessage = "The synonym ";
}
import eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase;
import eu.etaxonomy.cdm.api.service.config.NameDeletionConfigurator;
import eu.etaxonomy.cdm.api.service.config.SpecimenDeleteConfigurator;
-import eu.etaxonomy.cdm.api.service.config.TaxonBaseDeletionConfigurator;
+import eu.etaxonomy.cdm.api.service.config.SynonymDeletionConfigurator;
import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
import eu.etaxonomy.cdm.api.service.config.TaxonNodeDeletionConfigurator;
DeleteConfiguratorComposite composite = new DeleteConfiguratorComposite(parent, NONE);
if(configurator instanceof TaxonDeletionConfigurator){
composite.addConfiguratorComposite(new DeleteTaxonConfiguratorComposite((TaxonDeletionConfigurator) configurator, composite.getSectionConfigure(), SWT.NONE));
- }
- else if(configurator instanceof SpecimenDeleteConfigurator){
+ }else if (configurator instanceof SynonymDeletionConfigurator){
+ composite.addConfiguratorComposite(new DeleteTaxonBaseConfiguratorComposite((SynonymDeletionConfigurator) configurator, composite.getSectionConfigure(), SWT.NONE));
+ }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));
} else if(configurator instanceof NameDeletionConfigurator){
composite.addConfiguratorComposite(new DeleteNameConfiguratorComposite((NameDeletionConfigurator) configurator, composite.getSectionConfigure(), SWT.NONE));
}
-
+
return composite;
}
--- /dev/null
+// $Id$
+/**
+* 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.
+*/
+package eu.etaxonomy.taxeditor.ui.dialog.deleteConfigurator;
+
+import java.util.List;
+
+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.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+import eu.etaxonomy.cdm.api.service.config.NameDeletionConfigurator;
+import eu.etaxonomy.cdm.api.service.config.TaxonBaseDeletionConfigurator;
+import eu.etaxonomy.cdm.model.taxon.Classification;
+
+
+/**
+ * @author pplitzner
+ * @date Feb 18, 2015
+ *
+ */
+public class DeleteTaxonBaseConfiguratorComposite extends Composite implements SelectionListener{
+
+ protected DataBindingContext m_bindingContext;
+
+ private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());
+ protected final TaxonBaseDeletionConfigurator configurator;
+ private final Button btnDeleteTaxonName;
+
+
+ //name related
+ private final Button btnRemoveAllNameRelationships;
+ private final Button btnIgnoreIsBasionym;
+ private final Button btnIgnoreIsReplacedSynonymFor;
+ private final Button btnIgnoreHasBasionym;
+ private final Button btnIgnoreHasReplacedSynonym;
+ private final Button btnRemoveAllTypeDesignations;
+
+ private Combo classificationSelectionCombo;
+
+
+ Classification selectedClassification;
+ private List<Classification> classifications;
+
+
+ /**
+ * Create the composite.
+ * @param parent
+ * @param style
+ */
+ public DeleteTaxonBaseConfiguratorComposite(TaxonBaseDeletionConfigurator 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 GridLayout());
+ setBackground(getBackground());
+
+ btnDeleteTaxonName = new Button(this, SWT.CHECK);
+ btnDeleteTaxonName.setText("Delete taxon name if possible");
+ btnDeleteTaxonName.setSelection(true);
+ btnDeleteTaxonName.addListener(SWT.Selection, new Listener() {
+ @Override
+ public void handleEvent(Event e) {
+ Button b = (Button) e.widget;
+ GridData data = (GridData) btnRemoveAllNameRelationships.getLayoutData();
+ data.exclude = b.getSelection();
+ btnRemoveAllNameRelationships.setVisible(data.exclude);
+ btnIgnoreIsBasionym.setVisible(data.exclude);
+ btnIgnoreIsReplacedSynonymFor.setVisible(data.exclude);
+ btnIgnoreHasBasionym.setVisible(data.exclude);
+ btnIgnoreHasReplacedSynonym.setVisible(data.exclude);
+ btnRemoveAllTypeDesignations.setVisible(data.exclude);
+ }
+ });
+
+
+ //DeleteConfigurator for the name
+
+
+ btnRemoveAllNameRelationships = new Button(this, SWT.CHECK);
+ btnRemoveAllNameRelationships.setText("Remove all name relations");
+ btnRemoveAllNameRelationships.setSelection(true);
+
+ btnIgnoreIsBasionym = new Button(this, SWT.CHECK);
+ btnIgnoreIsBasionym.setText("Ignore if it is basionym");
+ btnIgnoreIsBasionym.setSelection(true);
+
+ btnIgnoreIsReplacedSynonymFor = new Button(this, SWT.CHECK);
+ btnIgnoreIsReplacedSynonymFor.setText("Ignore if it is replaced synonym");
+ btnIgnoreIsReplacedSynonymFor.setSelection(true);
+
+ btnIgnoreHasBasionym = new Button(this, SWT.CHECK);
+ btnIgnoreHasBasionym.setText("Ignore if it has basionym");
+ btnIgnoreHasBasionym.setSelection(true);
+
+ btnIgnoreHasReplacedSynonym = new Button(this, SWT.CHECK);
+ btnIgnoreHasReplacedSynonym.setText("Ignore if it has replaced synonym");
+ btnIgnoreHasReplacedSynonym.setSelection(true);
+
+ btnRemoveAllTypeDesignations = new Button(this, SWT.CHECK);
+ btnRemoveAllTypeDesignations.setText("Remove all type designations");
+ btnRemoveAllTypeDesignations.setSelection(true);
+
+
+
+ // createClassificationSelectionCombo(this);
+ initDataBindings();
+
+
+ }
+
+ protected void initDataBindings() {
+ m_bindingContext = new DataBindingContext();
+ //
+ IObservableValue observeSelectionBtnDeleteTaxonNameObserveWidget = WidgetProperties.selection().observe(btnDeleteTaxonName);
+ IObservableValue deleteNameIfPossibleConfiguratorObserveValue = PojoProperties.value("deleteNameIfPossible").observe(configurator);
+ m_bindingContext.bindValue(observeSelectionBtnDeleteTaxonNameObserveWidget, deleteNameIfPossibleConfiguratorObserveValue, null, null);
+
+ NameDeletionConfigurator nameConfig = configurator.getNameDeletionConfig();
+ IObservableValue observeSelectionbtnRemoveAllNameRelationshipsObserveWidget = WidgetProperties.selection().observe(btnRemoveAllNameRelationships);
+ IObservableValue deleteRemoveAllNameRelationshipsConfiguratorObserveValue = PojoProperties.value("removeAllNameRelationships").observe(nameConfig);
+ m_bindingContext.bindValue(observeSelectionbtnRemoveAllNameRelationshipsObserveWidget, deleteRemoveAllNameRelationshipsConfiguratorObserveValue, null, null);
+
+ IObservableValue observeSelectionbtnIgnoreIsBasionymObserveWidget = WidgetProperties.selection().observe(btnIgnoreIsBasionym);
+ IObservableValue deleteIgnoreIsBasionymConfiguratorObserveValue = PojoProperties.value("ignoreIsBasionymFor").observe(nameConfig);
+ m_bindingContext.bindValue(observeSelectionbtnIgnoreIsBasionymObserveWidget, deleteIgnoreIsBasionymConfiguratorObserveValue, null, null);
+
+ IObservableValue observeSelectionbtnIgnoreIsReplacedSynonymForObserveWidget = WidgetProperties.selection().observe(btnIgnoreIsReplacedSynonymFor);
+ IObservableValue deleteIgnoreIsReplacedSynonymForConfiguratorObserveValue = PojoProperties.value("ignoreIsReplacedSynonymFor").observe(nameConfig);
+ m_bindingContext.bindValue(observeSelectionbtnIgnoreIsReplacedSynonymForObserveWidget, deleteIgnoreIsReplacedSynonymForConfiguratorObserveValue, null, null);
+
+ IObservableValue observeSelectionbtnIgnoreHasBasionymObserveWidget = WidgetProperties.selection().observe(btnIgnoreHasBasionym);
+ IObservableValue deleteIgnoreHasBasionymConfiguratorObserveValue = PojoProperties.value("ignoreHasBasionym").observe(nameConfig);
+ m_bindingContext.bindValue(observeSelectionbtnIgnoreHasBasionymObserveWidget, deleteIgnoreHasBasionymConfiguratorObserveValue, null, null);
+
+ IObservableValue observeSelectionbtnIgnoreHasReplacedSynonymObserveWidget = WidgetProperties.selection().observe(btnIgnoreHasReplacedSynonym);
+ IObservableValue deleteIgnoreHasReplacedSynonymConfiguratorObserveValue = PojoProperties.value("ignoreHasReplacedSynonym").observe(nameConfig);
+ m_bindingContext.bindValue(observeSelectionbtnIgnoreHasReplacedSynonymObserveWidget, deleteIgnoreHasReplacedSynonymConfiguratorObserveValue, null, null);
+
+ IObservableValue observeSelectionbtnRemoveAllTypeDesignationsObserveWidget = WidgetProperties.selection().observe(btnRemoveAllTypeDesignations);
+ IObservableValue deleteRemoveAllTypeDesignationsConfiguratorObserveValue = PojoProperties.value("removeAllTypeDesignations").observe(nameConfig);
+ m_bindingContext.bindValue(observeSelectionbtnRemoveAllTypeDesignationsObserveWidget, deleteRemoveAllTypeDesignationsConfiguratorObserveValue, null, null);
+
+
+ }
+
+ /* private Control createClassificationSelectionCombo(Composite parent){
+// classifications = CdmStore.getTaxonTreeService().list(null, null, null, null, null);
+
+ Composite classificationSelection = new Composite(parent, SWT.NULL);
+ classificationSelection.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true));
+
+ GridLayout layout = new GridLayout();
+ classificationSelection.setLayout(layout);
+
+ Label label = new Label(classificationSelection, SWT.NULL);
+ // TODO not working is not really true but leave it here to remind everyone that this is under construction
+ label.setText("Select Classification");
+ classificationSelectionCombo = new Combo(classificationSelection, SWT.BORDER | SWT.READ_ONLY);
+ classificationSelectionCombo.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true));
+ classifications = CdmStore.getService(IClassificationService.class).list(null, null, null, null, null);
+
+ for(Classification tree : classifications){
+ classificationSelectionCombo.add(tree.getName().getText(), classifications.indexOf(tree));
+
+ }
+
+ classificationSelectionCombo.select(0);
+ classificationSelectionCombo.addSelectionListener(this);
+
+ return classificationSelection;
+ }*/
+
+@Override
+public void widgetSelected(SelectionEvent e) {
+ selectedClassification = classifications.get(classificationSelectionCombo.getSelectionIndex());
+}
+
+@Override
+public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+}
+}
-// $Id$
-/**
-* 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.
-*/
-package eu.etaxonomy.taxeditor.ui.dialog.deleteConfigurator;
-
-import java.util.List;
-
-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.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-
-import org.eclipse.swt.layout.RowLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-
-import eu.etaxonomy.cdm.api.service.IClassificationService;
-import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
-
-import eu.etaxonomy.cdm.model.taxon.Classification;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-
-
-/**
- * @author pplitzner
- * @date Feb 18, 2015
- *
- */
-public class DeleteTaxonConfiguratorComposite extends Composite implements SelectionListener{
- private final DataBindingContext m_bindingContext;
-
- private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());
- private final TaxonDeletionConfigurator configurator;
- private final Button btnDeleteTaxonName;
- private final Button btnDeleteInAllClassifications;
- private Combo classificationSelectionCombo;
- private
-
- Classification selectedClassification;
- private List<Classification> classifications;
-
-
- /**
- * Create the composite.
- * @param parent
- * @param style
- */
- public DeleteTaxonConfiguratorComposite(TaxonDeletionConfigurator 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 GridLayout());
- setBackground(getBackground());
-
- btnDeleteTaxonName = new Button(this, SWT.CHECK);
- btnDeleteTaxonName.setText("Delete taxon name if possible");
- btnDeleteTaxonName.setSelection(true);
-
- btnDeleteInAllClassifications = new Button(this, SWT.CHECK);
- btnDeleteInAllClassifications.setText("Delete taxon in all classifications");
- btnDeleteInAllClassifications.setSelection(true);
-
- // createClassificationSelectionCombo(this);
-
- m_bindingContext = initDataBindings();
-
- }
-
- protected DataBindingContext initDataBindings() {
- DataBindingContext bindingContext = new DataBindingContext();
- //
- IObservableValue observeSelectionBtnDeleteTaxonNameObserveWidget = WidgetProperties.selection().observe(btnDeleteTaxonName);
- IObservableValue deleteNameIfPossibleConfiguratorObserveValue = PojoProperties.value("deleteNameIfPossible").observe(configurator);
-
- IObservableValue observeSelectionBtnDeleteInAllClassificationObserveWidget = WidgetProperties.selection().observe(btnDeleteInAllClassifications);
- IObservableValue deleteInAllClassificationsConfiguratorObserveValue = PojoProperties.value("deleteInAllClassifications").observe(configurator);
- bindingContext.bindValue(observeSelectionBtnDeleteTaxonNameObserveWidget, deleteNameIfPossibleConfiguratorObserveValue, null, null);
- bindingContext.bindValue(observeSelectionBtnDeleteInAllClassificationObserveWidget, deleteInAllClassificationsConfiguratorObserveValue, null, null);
-
-
-
- //
- return bindingContext;
- }
-
- /* private Control createClassificationSelectionCombo(Composite parent){
-// classifications = CdmStore.getTaxonTreeService().list(null, null, null, null, null);
-
- Composite classificationSelection = new Composite(parent, SWT.NULL);
- classificationSelection.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true));
-
- GridLayout layout = new GridLayout();
- classificationSelection.setLayout(layout);
-
- Label label = new Label(classificationSelection, SWT.NULL);
- // TODO not working is not really true but leave it here to remind everyone that this is under construction
- label.setText("Select Classification");
- classificationSelectionCombo = new Combo(classificationSelection, SWT.BORDER | SWT.READ_ONLY);
- classificationSelectionCombo.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true));
- classifications = CdmStore.getService(IClassificationService.class).list(null, null, null, null, null);
-
- for(Classification tree : classifications){
- classificationSelectionCombo.add(tree.getName().getText(), classifications.indexOf(tree));
-
- }
-
- classificationSelectionCombo.select(0);
- classificationSelectionCombo.addSelectionListener(this);
-
- return classificationSelection;
- }*/
-
-@Override
-public void widgetSelected(SelectionEvent e) {
- selectedClassification = classifications.get(classificationSelectionCombo.getSelectionIndex());
-}
-
-@Override
-public void widgetDefaultSelected(SelectionEvent e) {
- // TODO Auto-generated method stub
-
-}
-}
+// $Id$\r
+/**\r
+* Copyright (C) 2016 EDIT\r
+* European Distributed Institute of Taxonomy\r
+* http://www.e-taxonomy.eu\r
+*\r
+* The contents of this file are subject to the Mozilla Public License Version 1.1\r
+* See LICENSE.TXT at the top of this package for the full license terms.\r
+*/\r
+package eu.etaxonomy.taxeditor.ui.dialog.deleteConfigurator;\r
+\r
+import org.eclipse.core.databinding.beans.PojoProperties;\r
+import org.eclipse.core.databinding.observable.value.IObservableValue;\r
+import org.eclipse.jface.databinding.swt.WidgetProperties;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.widgets.Button;\r
+import org.eclipse.swt.widgets.Composite;\r
+\r
+import eu.etaxonomy.cdm.api.service.config.TaxonBaseDeletionConfigurator;\r
+\r
+/**\r
+ * @author k.luther\r
+ * @date 19.04.2016\r
+ *\r
+ */\r
+public class DeleteTaxonConfiguratorComposite extends DeleteTaxonBaseConfiguratorComposite {\r
+\r
+ private final Button btnDeleteSynonyms;\r
+ private final Button btnDeleteMisappliedNamesAndInvalidDesignations;\r
+ private final Button btnTaxonRelationships;\r
+ private final Button btnConceptRelationships;\r
+ /**\r
+ * @param configurator\r
+ * @param parent\r
+ * @param style\r
+ */\r
+ public DeleteTaxonConfiguratorComposite(TaxonBaseDeletionConfigurator configurator, Composite parent, int style) {\r
+ super(configurator, parent, style);\r
+ btnDeleteSynonyms = new Button(this, SWT.CHECK);\r
+ btnDeleteSynonyms.setText("Delete synonyms if possible");\r
+ btnDeleteSynonyms.setSelection(true);\r
+\r
+ btnDeleteMisappliedNamesAndInvalidDesignations = new Button(this, SWT.CHECK);\r
+ btnDeleteMisappliedNamesAndInvalidDesignations.setText("Delete misapplied names and invalid designations if possible");\r
+ btnDeleteMisappliedNamesAndInvalidDesignations.setSelection(true);\r
+\r
+\r
+ btnTaxonRelationships = new Button(this, SWT.CHECK);\r
+ btnTaxonRelationships.setText("Delete taxon relations if possible");\r
+ btnTaxonRelationships.setSelection(true);\r
+\r
+ btnConceptRelationships = new Button(this, SWT.CHECK);\r
+ btnConceptRelationships.setText("Delete concept relations if possible");\r
+ btnConceptRelationships.setSelection(true);\r
+ initDataBindingsTaxon();\r
+ }\r
+\r
+ protected void initDataBindingsTaxon() {\r
+\r
+ IObservableValue observeSelectionBtnDeleteSynonymsObserveWidget = WidgetProperties.selection().observe(btnDeleteSynonyms);\r
+ IObservableValue deleteSynonymsConfiguratorObserveValue = PojoProperties.value("deleteSynonymsIfPossible").observe(configurator);\r
+ m_bindingContext.bindValue(observeSelectionBtnDeleteSynonymsObserveWidget, deleteSynonymsConfiguratorObserveValue, null, null);\r
+\r
+ IObservableValue observeSelectionbtnDeleteMisappliedNamesAndInvalidDesignationsObserveWidget = WidgetProperties.selection().observe(btnDeleteMisappliedNamesAndInvalidDesignations);\r
+ IObservableValue deleteMisappliedNamesAndInvalidDesignationsConfiguratorObserveValue = PojoProperties.value("deleteMisappliedNamesAndInvalidDesignationsIfPossible").observe(configurator);\r
+ m_bindingContext.bindValue(observeSelectionbtnDeleteMisappliedNamesAndInvalidDesignationsObserveWidget, deleteMisappliedNamesAndInvalidDesignationsConfiguratorObserveValue, null, null);\r
+\r
+ IObservableValue observeSelectionbtnTaxonRelationshipsObserveWidget = WidgetProperties.selection().observe(btnTaxonRelationships);\r
+ IObservableValue deleteTaxonRelationshipsConfiguratorObserveValue = PojoProperties.value("deleteTaxonRelationships").observe(configurator);\r
+ m_bindingContext.bindValue(observeSelectionbtnTaxonRelationshipsObserveWidget, deleteTaxonRelationshipsConfiguratorObserveValue, null, null);\r
+\r
+ IObservableValue observeSelectionbtnConceptRelationshipsObserveWidget = WidgetProperties.selection().observe(btnConceptRelationships);\r
+ IObservableValue deleteConceptRelationshipsConfiguratorObserveValue = PojoProperties.value("deleteConceptRelationships").observe(configurator);\r
+ m_bindingContext.bindValue(observeSelectionbtnConceptRelationshipsObserveWidget, deleteConceptRelationshipsConfiguratorObserveValue, null, null);\r
+\r
+ }\r
+}\r