1 |
f665e780
|
Katja Luther
|
/**
|
2 |
|
|
* Copyright (C) 2018 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.databaseAdmin.preferencePage;
|
10 |
|
|
|
11 |
f9b7a561
|
Katja Luther
|
import java.net.URI;
|
12 |
|
|
|
13 |
f665e780
|
Katja Luther
|
import org.eclipse.swt.SWT;
|
14 |
1844c796
|
Katja Luther
|
import org.eclipse.swt.custom.CLabel;
|
15 |
f665e780
|
Katja Luther
|
import org.eclipse.swt.events.SelectionAdapter;
|
16 |
|
|
import org.eclipse.swt.events.SelectionEvent;
|
17 |
|
|
import org.eclipse.swt.events.SelectionListener;
|
18 |
|
|
import org.eclipse.swt.layout.GridData;
|
19 |
|
|
import org.eclipse.swt.layout.GridLayout;
|
20 |
|
|
import org.eclipse.swt.widgets.Button;
|
21 |
|
|
import org.eclipse.swt.widgets.Combo;
|
22 |
|
|
import org.eclipse.swt.widgets.Composite;
|
23 |
|
|
import org.eclipse.swt.widgets.Control;
|
24 |
f9b7a561
|
Katja Luther
|
import org.eclipse.swt.widgets.Label;
|
25 |
|
|
import org.eclipse.swt.widgets.Text;
|
26 |
f665e780
|
Katja Luther
|
|
27 |
|
|
import eu.etaxonomy.cdm.api.application.ICdmRepository;
|
28 |
|
|
import eu.etaxonomy.cdm.api.service.IPreferenceService;
|
29 |
|
|
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
|
30 |
|
|
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
|
31 |
1d76231c
|
Katja Luther
|
import eu.etaxonomy.cdm.model.metadata.CdmPreference.PrefKey;
|
32 |
9b8d1a1c
|
Katja Luther
|
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
|
33 |
1d76231c
|
Katja Luther
|
import eu.etaxonomy.cdm.model.metadata.PreferenceSubject;
|
34 |
f665e780
|
Katja Luther
|
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
|
35 |
1844c796
|
Katja Luther
|
import eu.etaxonomy.taxeditor.l10n.Messages;
|
36 |
432276e4
|
Katja Luther
|
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
|
37 |
f665e780
|
Katja Luther
|
import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
|
38 |
|
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
39 |
|
|
|
40 |
|
|
/**
|
41 |
|
|
* @author k.luther
|
42 |
|
|
* @since 23.03.2018
|
43 |
|
|
*
|
44 |
|
|
*/
|
45 |
|
|
public class AbcdImportPreference extends CdmPreferencePage implements IE4AdminPreferencePage, SelectionListener {
|
46 |
|
|
|
47 |
|
|
private Abcd206ImportConfigurator configurator;
|
48 |
|
|
|
49 |
|
|
private Combo nomenclaturalCodeSelectionCombo;
|
50 |
|
|
|
51 |
1d76231c
|
Katja Luther
|
private boolean allowOverride = true;
|
52 |
5e3a2c94
|
Patrick Plitzner
|
private CdmPreference preference = null;
|
53 |
f9b7a561
|
Katja Luther
|
Text textDNAProviderString;
|
54 |
1d76231c
|
Katja Luther
|
|
55 |
f665e780
|
Katja Luther
|
@Override
|
56 |
|
|
protected Control createContents(Composite parent) {
|
57 |
|
|
final Composite composite = new Composite(parent, SWT.NULL);
|
58 |
|
|
|
59 |
|
|
GridLayout gridLayout = new GridLayout();
|
60 |
|
|
composite.setLayout(gridLayout);
|
61 |
1d76231c
|
Katja Luther
|
configurator = Abcd206ImportConfigurator.NewInstance(null,null);
|
62 |
|
|
ICdmRepository controller;
|
63 |
|
|
controller = CdmStore.getCurrentApplicationConfiguration();
|
64 |
9b8d1a1c
|
Katja Luther
|
PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.AbcdImportConfig);
|
65 |
f15b2642
|
Katja Luther
|
|
66 |
1d76231c
|
Katja Luther
|
if (controller == null){
|
67 |
|
|
return null;
|
68 |
|
|
}
|
69 |
|
|
preference = controller.getPreferenceService().find(key);
|
70 |
|
|
|
71 |
|
|
if (preference != null ){
|
72 |
|
|
allowOverride = preference.isAllowOverride();
|
73 |
f15b2642
|
Katja Luther
|
}else{
|
74 |
9b8d1a1c
|
Katja Luther
|
preference = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AbcdImportConfig, configurator.toString());
|
75 |
1d76231c
|
Katja Luther
|
}
|
76 |
|
|
|
77 |
|
|
if (preference != null){
|
78 |
|
|
|
79 |
|
|
String configString = preference.getValue();
|
80 |
0c7f7de7
|
Patrick Plitzner
|
String[] configArray = configString.split(";"); //$NON-NLS-1$
|
81 |
1d76231c
|
Katja Luther
|
|
82 |
|
|
for (String configItem: configArray){
|
83 |
0c7f7de7
|
Patrick Plitzner
|
String[] keyValue = configItem.split(":"); //$NON-NLS-1$
|
84 |
06738419
|
Patrick Plitzner
|
if(keyValue.length==2){
|
85 |
|
|
String keyString = keyValue[0];
|
86 |
|
|
String valueString = keyValue[1];
|
87 |
0c7f7de7
|
Patrick Plitzner
|
if (keyString.equals("ignoreImportOfExistingSpecimen")){ //$NON-NLS-1$
|
88 |
06738419
|
Patrick Plitzner
|
configurator.setIgnoreImportOfExistingSpecimen(Boolean.valueOf(valueString));
|
89 |
0c7f7de7
|
Patrick Plitzner
|
}else if (keyString.equals("addIndividualsAssociationsSuchAsSpecimenAndObservations")){ //$NON-NLS-1$
|
90 |
06738419
|
Patrick Plitzner
|
configurator.setAddIndividualsAssociationsSuchAsSpecimenAndObservations(Boolean.valueOf(valueString));
|
91 |
0c7f7de7
|
Patrick Plitzner
|
}else if (keyString.equals("reuseExistingTaxaWhenPossible")){ //$NON-NLS-1$
|
92 |
06738419
|
Patrick Plitzner
|
configurator.setReuseExistingTaxaWhenPossible(Boolean.valueOf(valueString));
|
93 |
0c7f7de7
|
Patrick Plitzner
|
}else if (keyString.equals("ignoreAuthorship")){ //$NON-NLS-1$
|
94 |
06738419
|
Patrick Plitzner
|
configurator.setIgnoreAuthorship(Boolean.valueOf(valueString));
|
95 |
0c7f7de7
|
Patrick Plitzner
|
}else if (keyString.equals("addMediaAsMediaSpecimen")){ //$NON-NLS-1$
|
96 |
06738419
|
Patrick Plitzner
|
configurator.setAddMediaAsMediaSpecimen(Boolean.valueOf(valueString));
|
97 |
0c7f7de7
|
Patrick Plitzner
|
}else if (keyString.equals("reuseExistingMetaData")){ //$NON-NLS-1$
|
98 |
06738419
|
Patrick Plitzner
|
configurator.setReuseExistingMetaData(Boolean.valueOf(valueString));
|
99 |
0c7f7de7
|
Patrick Plitzner
|
}else if (keyString.equals("reuseExistingDescriptiveGroups")){ //$NON-NLS-1$
|
100 |
06738419
|
Patrick Plitzner
|
configurator.setReuseExistingDescriptiveGroups(Boolean.valueOf(valueString));
|
101 |
0c7f7de7
|
Patrick Plitzner
|
}else if (keyString.equals("allowReuseOtherClassifications")){ //$NON-NLS-1$
|
102 |
06738419
|
Patrick Plitzner
|
configurator.setAllowReuseOtherClassifications(Boolean.valueOf(valueString));
|
103 |
0c7f7de7
|
Patrick Plitzner
|
}else if (keyString.equals("deduplicateReferences")){ //$NON-NLS-1$
|
104 |
06738419
|
Patrick Plitzner
|
configurator.setDeduplicateReferences(Boolean.valueOf(valueString));
|
105 |
0c7f7de7
|
Patrick Plitzner
|
}else if (keyString.equals("deduplicateClassifications")){ //$NON-NLS-1$
|
106 |
06738419
|
Patrick Plitzner
|
configurator.setDeduplicateClassifications(Boolean.valueOf(valueString));
|
107 |
0c7f7de7
|
Patrick Plitzner
|
}else if (keyString.equals("moveNewTaxaToDefaultClassification")){ //$NON-NLS-1$
|
108 |
06738419
|
Patrick Plitzner
|
configurator.setMoveNewTaxaToDefaultClassification(Boolean.valueOf(valueString));
|
109 |
0c7f7de7
|
Patrick Plitzner
|
}else if (keyString.equals("mapUnitIdToCatalogNumber")){ //$NON-NLS-1$
|
110 |
06738419
|
Patrick Plitzner
|
configurator.setMapUnitIdToCatalogNumber(Boolean.valueOf(valueString));
|
111 |
0c7f7de7
|
Patrick Plitzner
|
}else if (keyString.equals("mapUnitIdToAccessionNumber")){ //$NON-NLS-1$
|
112 |
06738419
|
Patrick Plitzner
|
configurator.setMapUnitIdToAccessionNumber(Boolean.valueOf(valueString));
|
113 |
0c7f7de7
|
Patrick Plitzner
|
}else if (keyString.equals("mapUnitIdToBarcode")){ //$NON-NLS-1$
|
114 |
06738419
|
Patrick Plitzner
|
configurator.setMapUnitIdToBarcode(Boolean.valueOf(valueString));
|
115 |
0c7f7de7
|
Patrick Plitzner
|
}else if (keyString.equals("overwriteExistingSpecimens")){ //$NON-NLS-1$
|
116 |
06738419
|
Patrick Plitzner
|
configurator.setOverwriteExistingSpecimens(Boolean.valueOf(valueString));
|
117 |
0c7f7de7
|
Patrick Plitzner
|
}else if (keyString.equals("nomenclaturalCode")){ //$NON-NLS-1$
|
118 |
06738419
|
Patrick Plitzner
|
configurator.setNomenclaturalCode(NomenclaturalCode.fromString(valueString));
|
119 |
432276e4
|
Katja Luther
|
}else if (keyString.equals("getSiblings")){ //$NON-NLS-1$
|
120 |
|
|
configurator.setGetSiblings(Boolean.valueOf(valueString));
|
121 |
|
|
}else if (keyString.equals("removeCountryFromLocalityText")){ //$NON-NLS-1$
|
122 |
|
|
configurator.setRemoveCountryFromLocalityText(Boolean.valueOf(valueString));
|
123 |
f9b7a561
|
Katja Luther
|
}else if (keyString.equals("dnaSource")){ //$NON-NLS-1$
|
124 |
|
|
configurator.setDnaSoure(URI.create(valueString));
|
125 |
06738419
|
Patrick Plitzner
|
}
|
126 |
432276e4
|
Katja Luther
|
|
127 |
1d76231c
|
Katja Luther
|
}
|
128 |
|
|
|
129 |
|
|
}
|
130 |
|
|
}
|
131 |
f665e780
|
Katja Luther
|
|
132 |
1d76231c
|
Katja Luther
|
|
133 |
|
|
//configurator = PreferencesUtil.getAbcdImportConfigurationPreference();
|
134 |
1844c796
|
Katja Luther
|
final CLabel description = new CLabel(composite, SWT.NULL);
|
135 |
|
|
description.setText(Messages.AbcdImportPreference_description);
|
136 |
f665e780
|
Katja Luther
|
Button checkBoxMediaSpecimen = new Button(composite, SWT.CHECK);
|
137 |
|
|
checkBoxMediaSpecimen.setSelection(configurator.isAddMediaAsMediaSpecimen());
|
138 |
1844c796
|
Katja Luther
|
checkBoxMediaSpecimen.setText(Messages.AbcdImportPreference_media_as_mediaSpecimen);
|
139 |
f665e780
|
Katja Luther
|
checkBoxMediaSpecimen
|
140 |
1844c796
|
Katja Luther
|
.setToolTipText(Messages.AbcdImportPreference_media_as_subUnit);
|
141 |
f665e780
|
Katja Luther
|
checkBoxMediaSpecimen.addSelectionListener(new SelectionAdapter() {
|
142 |
|
|
@Override
|
143 |
|
|
public void widgetSelected(SelectionEvent e) {
|
144 |
|
|
configurator.setAddMediaAsMediaSpecimen(!configurator.isAddMediaAsMediaSpecimen());
|
145 |
fbd932cc
|
Katja Luther
|
setApply(true);
|
146 |
f665e780
|
Katja Luther
|
}
|
147 |
|
|
});
|
148 |
|
|
|
149 |
|
|
Button checkBoxIgnoreExisting = new Button(composite, SWT.CHECK);
|
150 |
|
|
checkBoxIgnoreExisting.setSelection(configurator.isIgnoreImportOfExistingSpecimen());
|
151 |
1844c796
|
Katja Luther
|
checkBoxIgnoreExisting.setText(Messages.AbcdImportPreference_not_import_existing_specimen);
|
152 |
f665e780
|
Katja Luther
|
checkBoxIgnoreExisting
|
153 |
1844c796
|
Katja Luther
|
.setToolTipText(Messages.AbcdImportPreference_not_import_existing_specimen_tooltip);
|
154 |
f665e780
|
Katja Luther
|
checkBoxIgnoreExisting.addSelectionListener(new SelectionAdapter() {
|
155 |
|
|
@Override
|
156 |
|
|
public void widgetSelected(SelectionEvent e) {
|
157 |
|
|
configurator.setIgnoreImportOfExistingSpecimen(!configurator.isIgnoreImportOfExistingSpecimen());
|
158 |
fbd932cc
|
Katja Luther
|
setApply(true);
|
159 |
f665e780
|
Katja Luther
|
}
|
160 |
|
|
});
|
161 |
|
|
|
162 |
|
|
Button checkBoxIgnoreAuthorship = new Button(composite, SWT.CHECK);
|
163 |
|
|
checkBoxIgnoreAuthorship.setSelection(configurator.isIgnoreAuthorship());
|
164 |
1844c796
|
Katja Luther
|
checkBoxIgnoreAuthorship.setText(Messages.AbcdImportPreference_ignore_author);
|
165 |
f665e780
|
Katja Luther
|
checkBoxIgnoreAuthorship
|
166 |
1844c796
|
Katja Luther
|
.setToolTipText(Messages.AbcdImportPreference_ignore_author_tooltip);
|
167 |
f665e780
|
Katja Luther
|
checkBoxIgnoreAuthorship.addSelectionListener(new SelectionAdapter() {
|
168 |
|
|
@Override
|
169 |
|
|
public void widgetSelected(SelectionEvent e) {
|
170 |
|
|
configurator.setIgnoreAuthorship(!configurator.isIgnoreAuthorship());
|
171 |
fbd932cc
|
Katja Luther
|
setApply(true);
|
172 |
f665e780
|
Katja Luther
|
}
|
173 |
|
|
});
|
174 |
|
|
|
175 |
|
|
Button checkBoxMapUnitIdToCatalogNumber = new Button(composite, SWT.CHECK);
|
176 |
|
|
checkBoxMapUnitIdToCatalogNumber.setSelection(configurator.isMapUnitIdToCatalogNumber());
|
177 |
1844c796
|
Katja Luther
|
checkBoxMapUnitIdToCatalogNumber.setText(Messages.AbcdImportPreference_map_unit_nr_catalog_number);
|
178 |
f665e780
|
Katja Luther
|
checkBoxMapUnitIdToCatalogNumber
|
179 |
1844c796
|
Katja Luther
|
.setToolTipText(Messages.AbcdImportPreference_map_unit_number_catalog_number_tooltip);
|
180 |
f665e780
|
Katja Luther
|
checkBoxMapUnitIdToCatalogNumber.addSelectionListener(new SelectionAdapter() {
|
181 |
|
|
@Override
|
182 |
|
|
public void widgetSelected(SelectionEvent e) {
|
183 |
|
|
configurator.setMapUnitIdToCatalogNumber(!configurator.isMapUnitIdToCatalogNumber());
|
184 |
fbd932cc
|
Katja Luther
|
setApply(true);
|
185 |
f665e780
|
Katja Luther
|
}
|
186 |
|
|
});
|
187 |
|
|
//TODO: only one of the mappings can be checked!
|
188 |
|
|
Button checkBoxMapUnitIdToAccessionNumber = new Button(composite, SWT.CHECK);
|
189 |
|
|
checkBoxMapUnitIdToAccessionNumber.setSelection(configurator.isMapUnitIdToAccessionNumber());
|
190 |
1844c796
|
Katja Luther
|
checkBoxMapUnitIdToAccessionNumber.setText(Messages.AbcdImportPreference_map_unit_number_to_accession_number);
|
191 |
f665e780
|
Katja Luther
|
checkBoxMapUnitIdToAccessionNumber
|
192 |
1844c796
|
Katja Luther
|
.setToolTipText(Messages.AbcdImportPreference_map_unit_number_accession_number_tooltip);
|
193 |
f665e780
|
Katja Luther
|
checkBoxMapUnitIdToAccessionNumber.addSelectionListener(new SelectionAdapter() {
|
194 |
|
|
@Override
|
195 |
|
|
public void widgetSelected(SelectionEvent e) {
|
196 |
|
|
configurator.setMapUnitIdToAccessionNumber(!configurator.isMapUnitIdToAccessionNumber());
|
197 |
fbd932cc
|
Katja Luther
|
setApply(true);
|
198 |
f665e780
|
Katja Luther
|
}
|
199 |
|
|
});
|
200 |
|
|
|
201 |
|
|
Button checkBoxMapUnitIdToBarcode = new Button(composite, SWT.CHECK);
|
202 |
|
|
checkBoxMapUnitIdToBarcode.setSelection(configurator.isMapUnitIdToBarcode());
|
203 |
1844c796
|
Katja Luther
|
checkBoxMapUnitIdToBarcode.setText(Messages.AbcdImportPreference_map_unit_number_barcode);
|
204 |
f665e780
|
Katja Luther
|
checkBoxMapUnitIdToBarcode
|
205 |
1844c796
|
Katja Luther
|
.setToolTipText(Messages.AbcdImportPreference_map_unit_number_barcode_tooltip);
|
206 |
f665e780
|
Katja Luther
|
checkBoxMapUnitIdToBarcode.addSelectionListener(new SelectionAdapter() {
|
207 |
|
|
@Override
|
208 |
|
|
public void widgetSelected(SelectionEvent e) {
|
209 |
|
|
configurator.setMapUnitIdToBarcode(!configurator.isMapUnitIdToBarcode());
|
210 |
fbd932cc
|
Katja Luther
|
setApply(true);
|
211 |
f665e780
|
Katja Luther
|
}
|
212 |
|
|
});
|
213 |
|
|
|
214 |
|
|
Button checkBoxRemoveCountry = new Button(composite, SWT.CHECK);
|
215 |
|
|
checkBoxRemoveCountry.setSelection(configurator.isRemoveCountryFromLocalityText());
|
216 |
1844c796
|
Katja Luther
|
checkBoxRemoveCountry.setText(Messages.AbcdImportPreference_remove_country_from_locality);
|
217 |
f665e780
|
Katja Luther
|
checkBoxRemoveCountry
|
218 |
1844c796
|
Katja Luther
|
.setToolTipText(Messages.AbcdImportPreference_remove_country_from_locality_tooltip);
|
219 |
f665e780
|
Katja Luther
|
checkBoxRemoveCountry.addSelectionListener(new SelectionAdapter() {
|
220 |
|
|
@Override
|
221 |
|
|
public void widgetSelected(SelectionEvent e) {
|
222 |
|
|
configurator.setRemoveCountryFromLocalityText(!configurator.isRemoveCountryFromLocalityText());
|
223 |
fbd932cc
|
Katja Luther
|
setApply(true);
|
224 |
f665e780
|
Katja Luther
|
}
|
225 |
|
|
});
|
226 |
|
|
|
227 |
|
|
Button checkBoxMoveToDefaultClassification = new Button(composite, SWT.CHECK);
|
228 |
|
|
checkBoxMoveToDefaultClassification.setSelection(configurator.isMoveNewTaxaToDefaultClassification());
|
229 |
1844c796
|
Katja Luther
|
checkBoxMoveToDefaultClassification.setText(Messages.AbcdImportPreference_create_new_classification_new_taxa);
|
230 |
f665e780
|
Katja Luther
|
checkBoxMoveToDefaultClassification
|
231 |
1844c796
|
Katja Luther
|
.setToolTipText(Messages.AbcdImportPreference_create_new_classification_new_taxa_tooltip);
|
232 |
f665e780
|
Katja Luther
|
checkBoxMoveToDefaultClassification.addSelectionListener(new SelectionAdapter() {
|
233 |
|
|
@Override
|
234 |
|
|
public void widgetSelected(SelectionEvent e) {
|
235 |
|
|
configurator.setMoveNewTaxaToDefaultClassification(!configurator.isMoveNewTaxaToDefaultClassification());
|
236 |
fbd932cc
|
Katja Luther
|
setApply(true);
|
237 |
f665e780
|
Katja Luther
|
}
|
238 |
|
|
});
|
239 |
|
|
|
240 |
|
|
Button checkBoxImportSiblings = new Button(composite, SWT.CHECK);
|
241 |
|
|
checkBoxImportSiblings.setSelection(configurator.isGetSiblings());
|
242 |
1844c796
|
Katja Luther
|
checkBoxImportSiblings.setText(Messages.AbcdImportPreference_import_all_children_for_cultures_or_tissues);
|
243 |
f665e780
|
Katja Luther
|
checkBoxImportSiblings
|
244 |
1844c796
|
Katja Luther
|
.setToolTipText(Messages.AbcdImportPreference_import_all_children_for_cultures_or_tissues_tooltip);
|
245 |
f665e780
|
Katja Luther
|
checkBoxImportSiblings.addSelectionListener(new SelectionAdapter() {
|
246 |
|
|
@Override
|
247 |
|
|
public void widgetSelected(SelectionEvent e) {
|
248 |
432276e4
|
Katja Luther
|
configurator.setGetSiblings(!configurator.isGetSiblings());
|
249 |
fbd932cc
|
Katja Luther
|
setApply(true);
|
250 |
f665e780
|
Katja Luther
|
}
|
251 |
|
|
});
|
252 |
|
|
|
253 |
|
|
Button checkBoxAddIndividualsAssociations = new Button(composite, SWT.CHECK);
|
254 |
|
|
checkBoxAddIndividualsAssociations.setSelection(configurator.isAddIndividualsAssociationsSuchAsSpecimenAndObservations());
|
255 |
1844c796
|
Katja Luther
|
checkBoxAddIndividualsAssociations.setText(Messages.AbcdImportPreference_create_Individual_Association);
|
256 |
f665e780
|
Katja Luther
|
checkBoxAddIndividualsAssociations
|
257 |
1844c796
|
Katja Luther
|
.setToolTipText(Messages.AbcdImportPreference_create_Individual_Association_tooltip);
|
258 |
f665e780
|
Katja Luther
|
checkBoxAddIndividualsAssociations.addSelectionListener(new SelectionAdapter() {
|
259 |
|
|
@Override
|
260 |
|
|
public void widgetSelected(SelectionEvent e) {
|
261 |
|
|
configurator.setAddIndividualsAssociationsSuchAsSpecimenAndObservations(!configurator.isAddIndividualsAssociationsSuchAsSpecimenAndObservations());
|
262 |
fbd932cc
|
Katja Luther
|
setApply(true);
|
263 |
f665e780
|
Katja Luther
|
}
|
264 |
|
|
});
|
265 |
|
|
|
266 |
|
|
Button checkBoxReuseDescriptiveGroups = new Button(composite, SWT.CHECK);
|
267 |
|
|
checkBoxReuseDescriptiveGroups.setSelection(configurator.isReuseExistingDescriptiveGroups());
|
268 |
1844c796
|
Katja Luther
|
checkBoxReuseDescriptiveGroups.setText(Messages.AbcdImportPreference_reuse_descriptive_group);
|
269 |
f665e780
|
Katja Luther
|
checkBoxReuseDescriptiveGroups
|
270 |
1844c796
|
Katja Luther
|
.setToolTipText(Messages.AbcdImportPreference_reuse_descriptive_group_tooltip);
|
271 |
f665e780
|
Katja Luther
|
checkBoxReuseDescriptiveGroups.addSelectionListener(new SelectionAdapter() {
|
272 |
|
|
@Override
|
273 |
|
|
public void widgetSelected(SelectionEvent e) {
|
274 |
|
|
configurator.setReuseExistingDescriptiveGroups(!configurator.isReuseExistingDescriptiveGroups());
|
275 |
fbd932cc
|
Katja Luther
|
setApply(true);
|
276 |
f665e780
|
Katja Luther
|
}
|
277 |
|
|
});
|
278 |
|
|
|
279 |
|
|
Button checkBoxReuseExistingTaxa = new Button(composite, SWT.CHECK);
|
280 |
|
|
checkBoxReuseExistingTaxa.setSelection(configurator.isReuseExistingTaxaWhenPossible());
|
281 |
1844c796
|
Katja Luther
|
checkBoxReuseExistingTaxa.setText(Messages.AbcdImportPreference_reuse_existing_taxa);
|
282 |
f665e780
|
Katja Luther
|
checkBoxReuseExistingTaxa
|
283 |
1844c796
|
Katja Luther
|
.setToolTipText(Messages.AbcdImportPreference_reuse_existing_taxa_tooltip);
|
284 |
f665e780
|
Katja Luther
|
checkBoxReuseExistingTaxa.addSelectionListener(new SelectionAdapter() {
|
285 |
|
|
@Override
|
286 |
|
|
public void widgetSelected(SelectionEvent e) {
|
287 |
432276e4
|
Katja Luther
|
configurator.setReuseExistingTaxaWhenPossible(!configurator.isReuseExistingTaxaWhenPossible());
|
288 |
fbd932cc
|
Katja Luther
|
setApply(true);
|
289 |
f665e780
|
Katja Luther
|
}
|
290 |
|
|
});
|
291 |
|
|
|
292 |
f9b7a561
|
Katja Luther
|
Label labelRef = new Label(composite, SWT.NONE);
|
293 |
|
|
labelRef.setText("Biocase provider for associated DNA");
|
294 |
|
|
new Label(composite, SWT.NONE);
|
295 |
|
|
textDNAProviderString = new Text(composite, SWT.NONE);
|
296 |
|
|
textDNAProviderString.setEnabled(true);
|
297 |
|
|
textDNAProviderString.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true, 1, 1));
|
298 |
|
|
textDNAProviderString.setText(configurator.getDnaSoure().toString());
|
299 |
f665e780
|
Katja Luther
|
GridData gridData = new GridData();
|
300 |
|
|
gridData = new GridData(GridData.BEGINNING, GridData.CENTER, true, false);
|
301 |
|
|
gridData.horizontalIndent = 5;
|
302 |
|
|
// classificationSelection.setLayoutData(gridData);
|
303 |
|
|
|
304 |
|
|
nomenclaturalCodeSelectionCombo = new Combo(composite, SWT.BORDER| SWT.READ_ONLY);
|
305 |
|
|
nomenclaturalCodeSelectionCombo.setLayoutData(gridData);
|
306 |
|
|
for(NomenclaturalCode code: NomenclaturalCode.values()){
|
307 |
|
|
nomenclaturalCodeSelectionCombo.add(code.getKey());
|
308 |
|
|
}
|
309 |
a8de83de
|
Katja Luther
|
int index = 0;
|
310 |
|
|
if (configurator.getNomenclaturalCode() != null){
|
311 |
|
|
for (String label : nomenclaturalCodeSelectionCombo.getItems()){
|
312 |
|
|
if (label.equals(configurator.getNomenclaturalCode().getKey())){
|
313 |
|
|
nomenclaturalCodeSelectionCombo.select(index);
|
314 |
fbd932cc
|
Katja Luther
|
|
315 |
a8de83de
|
Katja Luther
|
}
|
316 |
|
|
index++;
|
317 |
|
|
}
|
318 |
|
|
}
|
319 |
f665e780
|
Katja Luther
|
|
320 |
|
|
// TODO remember last selection
|
321 |
|
|
nomenclaturalCodeSelectionCombo.addSelectionListener(this);
|
322 |
ae468727
|
Katja Luther
|
if (preference != null){
|
323 |
|
|
allowOverride = preference.isAllowOverride();
|
324 |
|
|
}
|
325 |
1d76231c
|
Katja Luther
|
Button checkAllowOverride = new Button(composite, SWT.CHECK);
|
326 |
|
|
checkAllowOverride.setSelection(allowOverride);
|
327 |
|
|
checkAllowOverride.setText(Messages.AbcdImportPreference_allow_override);
|
328 |
|
|
checkAllowOverride
|
329 |
|
|
.setToolTipText(Messages.AbcdImportPreference_allow_override_tooltip);
|
330 |
|
|
checkAllowOverride.addSelectionListener(new SelectionAdapter() {
|
331 |
|
|
@Override
|
332 |
|
|
public void widgetSelected(SelectionEvent e) {
|
333 |
|
|
allowOverride = !allowOverride;
|
334 |
fbd932cc
|
Katja Luther
|
setApply(true);
|
335 |
1d76231c
|
Katja Luther
|
}
|
336 |
|
|
});
|
337 |
|
|
|
338 |
f665e780
|
Katja Luther
|
return composite;
|
339 |
|
|
}
|
340 |
|
|
|
341 |
|
|
@Override
|
342 |
|
|
public void widgetSelected(SelectionEvent e) {
|
343 |
|
|
this.configurator.setNomenclaturalCode(NomenclaturalCode.getByKey(nomenclaturalCodeSelectionCombo.getText()));
|
344 |
fbd932cc
|
Katja Luther
|
setApply(true);
|
345 |
f665e780
|
Katja Luther
|
}
|
346 |
|
|
|
347 |
|
|
@Override
|
348 |
|
|
public boolean performOk() {
|
349 |
f15b2642
|
Katja Luther
|
if (preference == null){
|
350 |
|
|
return true;
|
351 |
|
|
}
|
352 |
f665e780
|
Katja Luther
|
if (configurator != null){
|
353 |
|
|
String configString = configurator.toString();
|
354 |
cc1302bd
|
Katja Luther
|
Abcd206ImportConfigurator defaultConfig = Abcd206ImportConfigurator.NewInstance(null,null);
|
355 |
|
|
if (configString.equals(defaultConfig.toString())){
|
356 |
|
|
configString = null;
|
357 |
|
|
}
|
358 |
9b8d1a1c
|
Katja Luther
|
CdmPreference pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AbcdImportConfig, configString);
|
359 |
1d76231c
|
Katja Luther
|
pref.setAllowOverride(allowOverride);
|
360 |
f665e780
|
Katja Luther
|
|
361 |
|
|
ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration();
|
362 |
|
|
if (controller == null){
|
363 |
|
|
return false;
|
364 |
|
|
}
|
365 |
|
|
IPreferenceService service = controller.getPreferenceService();
|
366 |
|
|
service.set(pref);
|
367 |
432276e4
|
Katja Luther
|
PreferencesUtil.updateDBPreferences();
|
368 |
1d76231c
|
Katja Luther
|
|
369 |
f665e780
|
Katja Luther
|
}
|
370 |
|
|
return true;
|
371 |
|
|
}
|
372 |
|
|
|
373 |
|
|
/**
|
374 |
|
|
* {@inheritDoc}
|
375 |
|
|
*/
|
376 |
|
|
@Override
|
377 |
|
|
public void widgetDefaultSelected(SelectionEvent e) {
|
378 |
|
|
// TODO Auto-generated method stub
|
379 |
|
|
|
380 |
|
|
}
|
381 |
|
|
|
382 |
85bd68d3
|
Katja Luther
|
@Override
|
383 |
|
|
protected void performDefaults() {
|
384 |
|
|
configurator = Abcd206ImportConfigurator.NewInstance(null,null);
|
385 |
|
|
preference = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AbcdImportConfig, configurator.toString());
|
386 |
|
|
preference.setAllowOverride(true);
|
387 |
|
|
super.performDefaults();
|
388 |
|
|
}
|
389 |
|
|
|
390 |
b6c6423a
|
Patrick Plitzner
|
// private void createAbcdImportConfig() {
|
391 |
|
|
// this.configurator.setAddIndividualsAssociationsSuchAsSpecimenAndObservations(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ADD_INDIVIDUALS_ASSOCIATIONS_SUCH_AS_SPECIMEN_AND_OBSERVATIONS));
|
392 |
|
|
// this.configurator.setAddMediaAsMediaSpecimen(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ADD_MEDIA_AS_MEDIASPECIMEN));
|
393 |
|
|
// this.configurator.setAllowReuseOtherClassifications(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ALLOW_REUSE_OTHER_CLASSIFICATIONS));
|
394 |
|
|
// //this.abcdImportConfigurator.setClassificationUuid(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_CLASSIFICATION_UUID));
|
395 |
|
|
// this.configurator.setDeduplicateClassifications(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DEDUPLICATE_CLASSIFICATIONS));
|
396 |
|
|
// this.configurator.setDeduplicateReferences(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DEDUPLICATE_REFERENCES));
|
397 |
|
|
// // this.abcdImportConfigurator.setDefaultAuthor(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DEFAULT_AUTHOR));
|
398 |
|
|
// this.configurator.setGetSiblings(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DO_SIBLINGS));
|
399 |
|
|
// this.configurator.setIgnoreAuthorship(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_IGNORE_AUTHORSHIP));
|
400 |
|
|
// this.configurator.setIgnoreImportOfExistingSpecimen(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_IGNORE_IMPORT_OF_EXISTING_SPECIMEN));
|
401 |
|
|
// this.configurator.setMapUnitIdToAccessionNumber(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TO_ACCESSION_NUMBER));
|
402 |
|
|
// this.configurator.setMapUnitIdToBarcode(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TO_BARCODE));
|
403 |
|
|
// this.configurator.setMapUnitIdToCatalogNumber(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TOCATALOG_NUMBER));
|
404 |
|
|
// this.configurator.setMoveNewTaxaToDefaultClassification(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MOVE_NEW_TAXA_TO_DEFAULT_CLASSIFICATION));
|
405 |
|
|
// this.configurator.setReuseExistingDescriptiveGroups(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_DESCRIPTIVE_GROUPS));
|
406 |
|
|
// this.configurator.setReuseExistingTaxaWhenPossible(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_TAXA_WHEN_POSSIBLE));
|
407 |
|
|
// this.configurator.setNomenclaturalCode(PreferencesUtil.getPreferredNomenclaturalCode(doGetPreferenceStore().getString(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_NOMENCLATURAL_CODE)));
|
408 |
|
|
//
|
409 |
|
|
// }
|
410 |
f665e780
|
Katja Luther
|
|
411 |
|
|
}
|