1
|
/**
|
2
|
* Copyright (C) 2016 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.taxeditor.ui.dialog.configurator.deleteConfigurator;
|
10
|
|
11
|
import org.eclipse.core.databinding.DataBindingContext;
|
12
|
import org.eclipse.core.databinding.beans.PojoProperties;
|
13
|
import org.eclipse.core.databinding.observable.value.IObservableValue;
|
14
|
import org.eclipse.jface.databinding.swt.WidgetProperties;
|
15
|
import org.eclipse.swt.SWT;
|
16
|
import org.eclipse.swt.layout.GridData;
|
17
|
import org.eclipse.swt.widgets.Button;
|
18
|
import org.eclipse.swt.widgets.Composite;
|
19
|
import org.eclipse.swt.widgets.Event;
|
20
|
import org.eclipse.swt.widgets.Listener;
|
21
|
|
22
|
import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
|
23
|
import eu.etaxonomy.cdm.api.service.config.TaxonNodeDeletionConfigurator;
|
24
|
|
25
|
/**
|
26
|
* @author k.luther
|
27
|
* @date 19.04.2016
|
28
|
*
|
29
|
*/
|
30
|
public class DeleteTaxonConfiguratorComposite extends DeleteTaxonBaseConfiguratorComposite {
|
31
|
|
32
|
private Button btnDeleteSynonyms;
|
33
|
private Button btnDeleteMisappliedNamesAndInvalidDesignations;
|
34
|
private Button btnTaxonRelationships;
|
35
|
private Button btnConceptRelationships;
|
36
|
|
37
|
private Button btnDeleteTaxon;
|
38
|
|
39
|
/**
|
40
|
* @param configurator
|
41
|
* @param parent
|
42
|
* @param style
|
43
|
*/
|
44
|
public DeleteTaxonConfiguratorComposite(TaxonDeletionConfigurator configurator, Composite parent, int style) {
|
45
|
super(configurator, parent, style);
|
46
|
}
|
47
|
|
48
|
@Override
|
49
|
protected void createContent(){
|
50
|
btnDeleteTaxon = new Button(this, SWT.CHECK);
|
51
|
btnDeleteTaxon.setText("Delete taxon if possible");
|
52
|
// btnDeleteTaxon.setSelection(true);
|
53
|
btnDeleteTaxon.addListener(SWT.Selection, new Listener() {
|
54
|
@Override
|
55
|
public void handleEvent(Event e) {
|
56
|
Button b = (Button) e.widget;
|
57
|
GridData data = (GridData) btnDeleteTaxon.getLayoutData();
|
58
|
data.exclude = b.getSelection();
|
59
|
|
60
|
btnDeleteSynonyms.setEnabled(data.exclude);
|
61
|
btnDeleteMisappliedNamesAndInvalidDesignations.setEnabled(data.exclude);
|
62
|
btnTaxonRelationships.setEnabled(data.exclude);
|
63
|
btnConceptRelationships.setEnabled(data.exclude);
|
64
|
btnDeleteTaxonName.setEnabled(data.exclude);
|
65
|
btnIgnoreHasBasionym.setEnabled(data.exclude);
|
66
|
btnIgnoreHasReplacedSynonym.setEnabled(data.exclude);
|
67
|
btnIgnoreIsBasionym.setEnabled(data.exclude);
|
68
|
btnIgnoreIsReplacedSynonymFor.setEnabled(data.exclude);
|
69
|
btnRemoveAllNameRelationships.setEnabled(data.exclude);
|
70
|
btnRemoveAllTypeDesignations.setEnabled(data.exclude);
|
71
|
|
72
|
}
|
73
|
});
|
74
|
|
75
|
btnDeleteSynonyms = new Button(this, SWT.CHECK);
|
76
|
GridData gd_btnDeleteSynonyms = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
|
77
|
gd_btnDeleteSynonyms.horizontalIndent = 10;
|
78
|
btnDeleteSynonyms.setLayoutData(gd_btnDeleteSynonyms);
|
79
|
btnDeleteSynonyms.setText("Delete synonyms if possible");
|
80
|
btnDeleteSynonyms.setSelection(true);
|
81
|
|
82
|
btnDeleteMisappliedNamesAndInvalidDesignations = new Button(this, SWT.CHECK);
|
83
|
GridData gd_btnDeleteMisappliedNamesAndInvalidDesignations = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
|
84
|
gd_btnDeleteMisappliedNamesAndInvalidDesignations.horizontalIndent = 10;
|
85
|
btnDeleteMisappliedNamesAndInvalidDesignations.setLayoutData(gd_btnDeleteMisappliedNamesAndInvalidDesignations);
|
86
|
btnDeleteMisappliedNamesAndInvalidDesignations.setText("Delete misapplied names and invalid designations if possible");
|
87
|
btnDeleteMisappliedNamesAndInvalidDesignations.setSelection(true);
|
88
|
|
89
|
|
90
|
btnTaxonRelationships = new Button(this, SWT.CHECK);
|
91
|
GridData gd_btnTaxonRelationships = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
|
92
|
gd_btnTaxonRelationships.horizontalIndent = 10;
|
93
|
btnTaxonRelationships.setLayoutData(gd_btnTaxonRelationships);
|
94
|
btnTaxonRelationships.setText("Delete taxon relations if possible");
|
95
|
btnTaxonRelationships.setSelection(true);
|
96
|
|
97
|
btnConceptRelationships = new Button(this, SWT.CHECK);
|
98
|
GridData gd_btnConceptRelationships = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
|
99
|
gd_btnConceptRelationships.horizontalIndent = 10;
|
100
|
btnConceptRelationships.setLayoutData(gd_btnConceptRelationships);
|
101
|
btnConceptRelationships.setText("Delete concept relations if possible");
|
102
|
btnConceptRelationships.setSelection(true);
|
103
|
super.createContent();
|
104
|
initDataBindingsTaxon();
|
105
|
}
|
106
|
|
107
|
protected void initDataBindingsTaxon() {
|
108
|
if (m_bindingContext == null){
|
109
|
m_bindingContext = new DataBindingContext();
|
110
|
}
|
111
|
TaxonNodeDeletionConfigurator nodeConfig = ((TaxonDeletionConfigurator)configurator).getTaxonNodeConfig();
|
112
|
if (nodeConfig == null){
|
113
|
nodeConfig = new TaxonNodeDeletionConfigurator();
|
114
|
((TaxonDeletionConfigurator)configurator).setTaxonNodeConfig(nodeConfig);
|
115
|
}
|
116
|
IObservableValue observeSelectionBtnDeleteTaxonObserveWidget = WidgetProperties.selection().observe(btnDeleteTaxon);
|
117
|
IObservableValue deleteTaxonConfiguratorObserveValue = PojoProperties.value("deleteTaxon").observe(nodeConfig);
|
118
|
m_bindingContext.bindValue(observeSelectionBtnDeleteTaxonObserveWidget, deleteTaxonConfiguratorObserveValue, null, null);
|
119
|
|
120
|
IObservableValue observeSelectionBtnDeleteSynonymsObserveWidget = WidgetProperties.selection().observe(btnDeleteSynonyms);
|
121
|
IObservableValue deleteSynonymsConfiguratorObserveValue = PojoProperties.value("deleteSynonymsIfPossible").observe(configurator);
|
122
|
m_bindingContext.bindValue(observeSelectionBtnDeleteSynonymsObserveWidget, deleteSynonymsConfiguratorObserveValue, null, null);
|
123
|
|
124
|
IObservableValue observeSelectionbtnDeleteMisappliedNamesAndInvalidDesignationsObserveWidget = WidgetProperties.selection().observe(btnDeleteMisappliedNamesAndInvalidDesignations);
|
125
|
IObservableValue deleteMisappliedNamesAndInvalidDesignationsConfiguratorObserveValue = PojoProperties.value("deleteMisappliedNamesAndInvalidDesignationsIfPossible").observe(configurator);
|
126
|
m_bindingContext.bindValue(observeSelectionbtnDeleteMisappliedNamesAndInvalidDesignationsObserveWidget, deleteMisappliedNamesAndInvalidDesignationsConfiguratorObserveValue, null, null);
|
127
|
|
128
|
IObservableValue observeSelectionbtnTaxonRelationshipsObserveWidget = WidgetProperties.selection().observe(btnTaxonRelationships);
|
129
|
IObservableValue deleteTaxonRelationshipsConfiguratorObserveValue = PojoProperties.value("deleteTaxonRelationships").observe(configurator);
|
130
|
m_bindingContext.bindValue(observeSelectionbtnTaxonRelationshipsObserveWidget, deleteTaxonRelationshipsConfiguratorObserveValue, null, null);
|
131
|
|
132
|
IObservableValue observeSelectionbtnConceptRelationshipsObserveWidget = WidgetProperties.selection().observe(btnConceptRelationships);
|
133
|
IObservableValue deleteConceptRelationshipsConfiguratorObserveValue = PojoProperties.value("deleteConceptRelationships").observe(configurator);
|
134
|
m_bindingContext.bindValue(observeSelectionbtnConceptRelationshipsObserveWidget, deleteConceptRelationshipsConfiguratorObserveValue, null, null);
|
135
|
|
136
|
}
|
137
|
}
|