INameService service = controller.getNameService();
if (object != null){
NameDeletionConfigurator config = new NameDeletionConfigurator();
+
+ DeleteConfiguratorDialog dialog = new DeleteConfiguratorDialog(config, HandlerUtil.getActiveShell(event), "Confirm Deletion", null, "Do you really want to delete the name", MessageDialog.WARNING, new String[] { "Delete", "Skip" }, 0);
+ int result_dialog= dialog.open();
+ if (result_dialog == 1){
+ return null;
+ }
result = service.delete(((TaxonNameBase) object).getUuid(), config);
errorMessage = "The name ";
}
errorMessage = "The taxon ";
}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 org.eclipse.swt.widgets.Shell;
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.TaxonDeletionConfigurator;
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
+package eu.etaxonomy.taxeditor.ui.dialog.deleteConfigurator;
+
+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.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.Display;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+import eu.etaxonomy.cdm.api.service.config.NameDeletionConfigurator;
+import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
+/**
+ * @author kluther
+ * @date Nov 2, 2015
+ *
+ */
+public class DeleteNameConfiguratorComposite extends Composite {
+ private final DataBindingContext m_bindingContext;
+
+ private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());
+ private final NameDeletionConfigurator configurator;
+ 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 boolean removeAllNameRelationships = false;
+
+ private boolean ignoreIsBasionymFor = false;
+
+ private boolean ignoreIsReplacedSynonymFor = false;
+
+ private boolean ignoreHasBasionym = true;
+
+ private boolean ignoreHasReplacedSynonym = true;
+
+ private boolean removeAllNameTypeDesignations = true;
+ */
+
+
+ /**
+ * Create the composite.
+ * @param parent
+ * @param style
+ */
+ public DeleteNameConfiguratorComposite(NameDeletionConfigurator 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());
+
+ btnRemoveAllNameRelationships = new Button(this, SWT.CHECK);
+ btnRemoveAllNameRelationships.setText("Remove all Name Relationships");
+ btnRemoveAllNameRelationships.setSelection(true);
+
+ btnIgnoreIsBasionym = new Button(this, SWT.CHECK);
+ btnIgnoreIsBasionym.setText("Ignore is Basionym");
+ btnIgnoreIsBasionym.setSelection(true);
+
+ btnIgnoreIsReplacedSynonymFor = new Button(this, SWT.CHECK);
+ btnIgnoreIsReplacedSynonymFor.setText("Ignore is Replaced Synonym");
+ btnIgnoreIsReplacedSynonymFor.setSelection(true);
+
+ btnIgnoreHasBasionym = new Button(this, SWT.CHECK);
+ btnIgnoreHasBasionym.setText("Ignore has Basionym");
+ btnIgnoreHasBasionym.setSelection(true);
+
+ btnIgnoreHasReplacedSynonym = new Button(this, SWT.CHECK);
+ btnIgnoreHasReplacedSynonym.setText("Ignore has Replaced Synonym");
+ btnIgnoreHasReplacedSynonym.setSelection(true);
+
+ btnRemoveAllTypeDesignations = new Button(this, SWT.CHECK);
+ btnRemoveAllTypeDesignations.setText("Remove all Type Designations");
+ btnRemoveAllTypeDesignations.setSelection(true);
+
+ m_bindingContext = initDataBindings();
+
+ }
+
+ protected DataBindingContext initDataBindings() {
+ DataBindingContext bindingContext = new DataBindingContext();
+ //
+ IObservableValue observeSelectionBtnRemoveAllNameRelationshipsWidget = WidgetProperties.selection().observe(btnRemoveAllNameRelationships);
+ IObservableValue removeAllNameRelationshipsConfiguratorObserveValue = PojoProperties.value("removeAllNameRelationships").observe(configurator);
+ bindingContext.bindValue(observeSelectionBtnRemoveAllNameRelationshipsWidget, removeAllNameRelationshipsConfiguratorObserveValue, null, null);
+
+ IObservableValue observeSelectionBtnbtnIgnoreIsBasionymObserveWidget = WidgetProperties.selection().observe(btnIgnoreIsBasionym);
+ IObservableValue ignoreIsBasionymConfiguratorObserveValue = PojoProperties.value("ignoreIsBasionymFor").observe(configurator);
+ bindingContext.bindValue(observeSelectionBtnbtnIgnoreIsBasionymObserveWidget, ignoreIsBasionymConfiguratorObserveValue, null, null);
+
+ IObservableValue observeSelectionBtnIgnoreIsReplacedSynonymForWidget = WidgetProperties.selection().observe(btnIgnoreIsReplacedSynonymFor);
+ IObservableValue ignoreIsReplacedSynonymForConfiguratorObserveValue = PojoProperties.value("ignoreIsReplacedSynonymFor").observe(configurator);
+ bindingContext.bindValue(observeSelectionBtnIgnoreIsReplacedSynonymForWidget, ignoreIsReplacedSynonymForConfiguratorObserveValue, null, null);
+
+ IObservableValue observeSelectionBtnIgnoreHasBasionymWidget = WidgetProperties.selection().observe(btnIgnoreHasBasionym);
+ IObservableValue ignoreHasBasionymConfiguratorObserveValue = PojoProperties.value("ignoreHasBasionym").observe(configurator);
+ bindingContext.bindValue(observeSelectionBtnIgnoreHasBasionymWidget, ignoreHasBasionymConfiguratorObserveValue, null, null);
+
+ IObservableValue observeSelectionBtnIgnoreHasReplacedSynonymWidget = WidgetProperties.selection().observe(btnIgnoreHasReplacedSynonym);
+ IObservableValue ignoreHasReplacedSynonymConfiguratorObserveValue = PojoProperties.value("ignoreHasReplacedSynonym").observe(configurator);
+ bindingContext.bindValue(observeSelectionBtnIgnoreHasReplacedSynonymWidget, ignoreHasReplacedSynonymConfiguratorObserveValue, null, null);
+
+ IObservableValue observeSelectionBtnRemoveAllTypeDesignationsWidget = WidgetProperties.selection().observe(btnRemoveAllTypeDesignations);
+ IObservableValue removeAllNameTypeDesignationsConfiguratorObserveValue = PojoProperties.value("removeAllNameTypeDesignations").observe(configurator);
+ bindingContext.bindValue(observeSelectionBtnRemoveAllTypeDesignationsWidget, removeAllNameTypeDesignationsConfiguratorObserveValue, null, null);
+
+ //
+ return bindingContext;
+ }
+}
*/
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.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.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.common.CdmUtils;
+
import eu.etaxonomy.cdm.model.taxon.Classification;
+import eu.etaxonomy.taxeditor.store.CdmStore;
/**
* @date Feb 18, 2015
*
*/
-public class DeleteTaxonConfiguratorComposite extends Composite {
+public class DeleteTaxonConfiguratorComposite extends Composite implements SelectionListener{
private final DataBindingContext m_bindingContext;
private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());
private final Button btnDeleteTaxonName;
private final Button btnDeleteInAllClassifications;
private Combo classificationSelectionCombo;
-
+ private
+
+ Classification selectedClassification;
+ private List<Classification> classifications;
/**
}
});
toolkit.paintBordersFor(this);
- setLayout(new RowLayout(SWT.VERTICAL));
+ setLayout(new GridLayout());
setBackground(getBackground());
btnDeleteTaxonName = new Button(this, SWT.CHECK);
btnDeleteInAllClassifications.setText("Delete taxon in all classifications");
btnDeleteInAllClassifications.setSelection(true);
+ // createClassificationSelectionCombo(this);
+
m_bindingContext = initDataBindings();
}
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){
+ /* 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, false));
+ classificationSelection.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true));
GridLayout layout = new GridLayout();
classificationSelection.setLayout(layout);
label.setText("Select Classification");
classificationSelectionCombo = new Combo(classificationSelection, SWT.BORDER | SWT.READ_ONLY);
classificationSelectionCombo.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true));
- List<Classification> classifications =
+ 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(classifications.indexOf(selectedClassification));
-
- // TODO remember last selection
+ 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
+
+}
}
--- /dev/null
+package eu.etaxonomy.taxeditor.ui.selection;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.model.taxon.Classification;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+
+public class ClassificationSelectionElement extends EntitySelectionElement<Classification> {
+
+ public ClassificationSelectionElement(CdmFormFactory formFactory,
+ ConversationHolder conversation, ICdmFormElement parentElement,
+ Class<Classification> clazz, String labelString,
+ Classification entity, int mode, int style) {
+ super(formFactory, conversation, parentElement, clazz, labelString, entity,
+ mode, style);
+
+ }
+
+}