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.databaseAdmin.wizard;
|
10
|
|
11
|
import java.util.List;
|
12
|
|
13
|
import org.eclipse.jface.preference.IPreferenceStore;
|
14
|
import org.eclipse.jface.wizard.IWizard;
|
15
|
import org.eclipse.jface.wizard.IWizardPage;
|
16
|
import org.eclipse.jface.wizard.WizardPage;
|
17
|
import org.eclipse.swt.SWT;
|
18
|
import org.eclipse.swt.events.SelectionAdapter;
|
19
|
import org.eclipse.swt.events.SelectionEvent;
|
20
|
import org.eclipse.swt.layout.GridData;
|
21
|
import org.eclipse.swt.layout.GridLayout;
|
22
|
import org.eclipse.swt.widgets.Button;
|
23
|
import org.eclipse.swt.widgets.Combo;
|
24
|
import org.eclipse.swt.widgets.Composite;
|
25
|
import org.eclipse.swt.widgets.Label;
|
26
|
import org.eclipse.swt.widgets.TabFolder;
|
27
|
import org.eclipse.swt.widgets.TabItem;
|
28
|
|
29
|
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
|
30
|
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
|
31
|
import eu.etaxonomy.taxeditor.Messages;
|
32
|
import eu.etaxonomy.taxeditor.model.NomenclaturalCodeHelper;
|
33
|
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
|
34
|
import eu.etaxonomy.taxeditor.preference.NameDetailsConfigurator;
|
35
|
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
|
36
|
|
37
|
/**
|
38
|
* @author k.luther
|
39
|
* @date 01.11.2016
|
40
|
*
|
41
|
*/
|
42
|
public class DatabasePreferencesPage extends WizardPage implements IWizardPage{
|
43
|
|
44
|
CdmPreference preferedNomenclaturalCode;
|
45
|
NameDetailsConfigurator config ;
|
46
|
CdmPreference isRedListPreference;
|
47
|
CdmPreference determinationOnlyForFieldUnitsPreference;
|
48
|
CdmPreference showCollectingAreaInGeneralSectionPreference;
|
49
|
CdmPreference showTaxonAssociationsPreference;
|
50
|
|
51
|
|
52
|
TabFolder tabFolder;
|
53
|
|
54
|
IPreferenceStore preferenceStore;
|
55
|
Composite composite;
|
56
|
boolean isSimpleDetailsViewActivated;
|
57
|
Composite child ;
|
58
|
|
59
|
private Combo nomenclaturalCodeCombo;
|
60
|
private Label nomenclaturalCodeLabel;
|
61
|
|
62
|
String[][] labelAndValues;
|
63
|
|
64
|
/*
|
65
|
*
|
66
|
*/
|
67
|
public DatabasePreferencesPage(String pageName) {
|
68
|
super(pageName);
|
69
|
this.preferedNomenclaturalCode = PreferencesUtil.setPreferredNomenclaturalCode(null, false);
|
70
|
this.config = PreferencesUtil.setPreferredNameDetailsConfiguration( false);
|
71
|
setPreferenceStore(PreferencesUtil.getPreferenceStore());
|
72
|
|
73
|
}
|
74
|
|
75
|
protected void setPreferenceStore(IPreferenceStore store){
|
76
|
this.preferenceStore = store;
|
77
|
}
|
78
|
|
79
|
|
80
|
|
81
|
|
82
|
/***
|
83
|
* Adds a tab to the page.
|
84
|
* @param text the tab label
|
85
|
*/
|
86
|
public Composite addTab(String text) {
|
87
|
if (tabFolder == null){
|
88
|
// initialize tab folder
|
89
|
if (composite == null) {
|
90
|
composite = new Composite(getShell(), SWT.NONE);
|
91
|
}
|
92
|
tabFolder = new TabFolder(composite, SWT.NONE);
|
93
|
tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
|
94
|
}
|
95
|
|
96
|
TabItem item = new TabItem(tabFolder, SWT.NONE);
|
97
|
item.setText(text);
|
98
|
|
99
|
Composite currentTab = new Composite(tabFolder, SWT.NULL);
|
100
|
GridLayout layout = new GridLayout();
|
101
|
currentTab.setLayout(layout);
|
102
|
currentTab.setFont(composite.getFont());
|
103
|
currentTab.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
104
|
|
105
|
item.setControl(currentTab);
|
106
|
return currentTab;
|
107
|
}
|
108
|
|
109
|
/**
|
110
|
* @param tabFolder
|
111
|
*/
|
112
|
private void createNameDetailsConfiguration(Composite parent) {
|
113
|
if (composite == null){
|
114
|
composite = parent;
|
115
|
}
|
116
|
composite = addTab("Name Details View Configuration");
|
117
|
// TabItem tbtmNameDetailsConfiguration = new TabItem(tabFolder, SWT.NONE);
|
118
|
// Composite c2 = new Composite(tabFolder, SWT.BORDER);
|
119
|
// c2.setLayout(new GridLayout(1, true));
|
120
|
// tbtmNameDetailsConfiguration.setControl(c2);
|
121
|
// composite.setLayout(new GridLayout(1, true));
|
122
|
config = new NameDetailsConfigurator(true);
|
123
|
|
124
|
// Composite composite = new Composite(parent, SWT.NULL);
|
125
|
composite.setLayout(new GridLayout());
|
126
|
|
127
|
isSimpleDetailsViewActivated= PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION);
|
128
|
final Button activateCheckButton = new Button(composite, SWT.CHECK);
|
129
|
activateCheckButton.setText("Show only a simple name details view");
|
130
|
activateCheckButton.setSelection(isSimpleDetailsViewActivated);
|
131
|
activateCheckButton.addSelectionListener(new SelectionAdapter(){
|
132
|
@Override
|
133
|
public void widgetSelected(SelectionEvent e) {
|
134
|
isSimpleDetailsViewActivated = activateCheckButton.getSelection();
|
135
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION, isSimpleDetailsViewActivated);
|
136
|
if(isSimpleDetailsViewActivated){
|
137
|
child.setVisible(true);
|
138
|
child.setEnabled(true);
|
139
|
}else{
|
140
|
child.setVisible(false);
|
141
|
child.setEnabled(false);
|
142
|
}
|
143
|
}
|
144
|
});
|
145
|
|
146
|
child = new Composite(composite, SWT.NULL);
|
147
|
child.setLayout(new GridLayout());
|
148
|
child.setVisible(isSimpleDetailsViewActivated);
|
149
|
|
150
|
final Button showTaxon = new Button(child, SWT.CHECK);
|
151
|
boolean isShowTaxon = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON);
|
152
|
showTaxon.setText("Show taxon of the name");
|
153
|
showTaxon.setSelection(isShowTaxon);
|
154
|
showTaxon.addSelectionListener(new SelectionAdapter(){
|
155
|
@Override
|
156
|
public void widgetSelected(SelectionEvent e) {
|
157
|
boolean isShowTaxon = showTaxon.getSelection();
|
158
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON, isShowTaxon);
|
159
|
}
|
160
|
});
|
161
|
|
162
|
final Button showLsid = new Button(child, SWT.CHECK);
|
163
|
boolean isShowLSID = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID);
|
164
|
showLsid.setText("Show Lsid of the name");
|
165
|
showLsid.setSelection(isShowLSID);
|
166
|
showLsid.addSelectionListener(new SelectionAdapter(){
|
167
|
@Override
|
168
|
public void widgetSelected(SelectionEvent e) {
|
169
|
boolean isShowLSID = showLsid.getSelection();
|
170
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID, isShowLSID);
|
171
|
}
|
172
|
});
|
173
|
|
174
|
final Button showNomenclaturalCode = new Button(child, SWT.CHECK);
|
175
|
boolean isShowNomenclaturalCode = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE);
|
176
|
showNomenclaturalCode.setText("Show the nomenclatural code");
|
177
|
showNomenclaturalCode.setSelection(isShowNomenclaturalCode);
|
178
|
showNomenclaturalCode.addSelectionListener(new SelectionAdapter(){
|
179
|
@Override
|
180
|
public void widgetSelected(SelectionEvent e) {
|
181
|
boolean isShowNomenclaturalCode = showNomenclaturalCode.getSelection();
|
182
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE, isShowNomenclaturalCode);
|
183
|
}
|
184
|
});
|
185
|
|
186
|
final Button showNameCache = new Button(child, SWT.CHECK);
|
187
|
boolean isShowNameCache = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE);
|
188
|
showNameCache.setText("Show nameCache of the name (only the scientific name without the author and year)");
|
189
|
showNameCache.setSelection(isShowNomenclaturalCode);
|
190
|
showNameCache.addSelectionListener(new SelectionAdapter(){
|
191
|
@Override
|
192
|
public void widgetSelected(SelectionEvent e) {
|
193
|
boolean isShowNameCache = showNameCache.getSelection();
|
194
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE, isShowNameCache);
|
195
|
}
|
196
|
});
|
197
|
final Button showAppendedPhrase = new Button(child, SWT.CHECK);
|
198
|
boolean isShowAppendedPhrase = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE);
|
199
|
showAppendedPhrase.setText("Show appended phrase");
|
200
|
showAppendedPhrase.setSelection(isShowAppendedPhrase);
|
201
|
showAppendedPhrase.addSelectionListener(new SelectionAdapter(){
|
202
|
@Override
|
203
|
public void widgetSelected(SelectionEvent e) {
|
204
|
boolean isShowAppendedPhrase = showAppendedPhrase.getSelection();
|
205
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE, isShowAppendedPhrase);
|
206
|
}
|
207
|
});
|
208
|
|
209
|
final Button showRank = new Button(child, SWT.CHECK);
|
210
|
boolean isShowRank = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK);
|
211
|
showRank.setText("Show rank of the name");
|
212
|
showRank.setSelection(isShowRank);
|
213
|
showRank.addSelectionListener(new SelectionAdapter(){
|
214
|
@Override
|
215
|
public void widgetSelected(SelectionEvent e) {
|
216
|
boolean isShowRank = showRank.getSelection();
|
217
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK, isShowRank);
|
218
|
}
|
219
|
});
|
220
|
final Button showEpithets = new Button(child, SWT.CHECK);
|
221
|
boolean isShowEpithets = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS);
|
222
|
showEpithets.setText("Show atomised epithets");
|
223
|
showEpithets.setSelection(isShowEpithets);
|
224
|
showEpithets.addSelectionListener(new SelectionAdapter(){
|
225
|
@Override
|
226
|
public void widgetSelected(SelectionEvent e) {
|
227
|
boolean isShowEpithets = showEpithets.getSelection();
|
228
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS, isShowEpithets);
|
229
|
}
|
230
|
});
|
231
|
final Button showAuthorship = new Button(child, SWT.CHECK);
|
232
|
boolean isShowAuthorship = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP);
|
233
|
showAuthorship.setText("Show authorship section");
|
234
|
showAuthorship.setSelection(isShowAuthorship);
|
235
|
showAuthorship.addSelectionListener(new SelectionAdapter(){
|
236
|
@Override
|
237
|
public void widgetSelected(SelectionEvent e) {
|
238
|
boolean isShowAuthorship = showAuthorship.getSelection();
|
239
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP, isShowAuthorship);
|
240
|
}
|
241
|
});
|
242
|
|
243
|
final Button showNomenclaturalRef = new Button(child, SWT.CHECK);
|
244
|
boolean isShowNomenclaturalRef = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE);
|
245
|
showNomenclaturalRef.setText("Show nomenclatural reference section");
|
246
|
showNomenclaturalRef.setSelection(isShowNomenclaturalRef);
|
247
|
showNomenclaturalRef.addSelectionListener(new SelectionAdapter(){
|
248
|
@Override
|
249
|
public void widgetSelected(SelectionEvent e) {
|
250
|
boolean isShowNomenclaturalRef = showNomenclaturalRef.getSelection();
|
251
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE, isShowNomenclaturalRef);
|
252
|
}
|
253
|
});
|
254
|
|
255
|
final Button showNomenclaturalStatus = new Button(child, SWT.CHECK);
|
256
|
boolean isShowNomenclaturalStatus = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS);
|
257
|
showNomenclaturalStatus.setText("Show nomenclatural status section");
|
258
|
showNomenclaturalStatus.setSelection(isShowNomenclaturalStatus);
|
259
|
showNomenclaturalStatus.addSelectionListener(new SelectionAdapter(){
|
260
|
@Override
|
261
|
public void widgetSelected(SelectionEvent e) {
|
262
|
boolean isShowNomenclaturalStatus = showNomenclaturalStatus.getSelection();
|
263
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS, isShowNomenclaturalStatus);
|
264
|
}
|
265
|
});
|
266
|
|
267
|
final Button showProtologue = new Button(child, SWT.CHECK);
|
268
|
boolean isShowProtologue = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE);
|
269
|
showProtologue.setText("Show protologue section");
|
270
|
showProtologue.setSelection(isShowProtologue);
|
271
|
showProtologue.addSelectionListener(new SelectionAdapter(){
|
272
|
@Override
|
273
|
public void widgetSelected(SelectionEvent e) {
|
274
|
boolean isShowProtologue = showProtologue.getSelection();
|
275
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE, isShowProtologue);
|
276
|
}
|
277
|
});
|
278
|
|
279
|
final Button showTypeDesignation = new Button(child, SWT.CHECK);
|
280
|
boolean isShowTypeDesignation = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION);
|
281
|
showTypeDesignation.setText("Show name type designation section");
|
282
|
showTypeDesignation.setSelection(isShowTypeDesignation);
|
283
|
showTypeDesignation.addSelectionListener(new SelectionAdapter(){
|
284
|
@Override
|
285
|
public void widgetSelected(SelectionEvent e) {
|
286
|
boolean isShowTypeDesignation = showTypeDesignation.getSelection();
|
287
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION, isShowTypeDesignation);
|
288
|
}
|
289
|
});
|
290
|
|
291
|
|
292
|
final Button showNameRelationship = new Button(child, SWT.CHECK);
|
293
|
boolean isShowNameRelationship = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP);
|
294
|
showNameRelationship.setText("Show name relationship section");
|
295
|
showNameRelationship.setSelection(isShowNameRelationship);
|
296
|
showNameRelationship.addSelectionListener(new SelectionAdapter(){
|
297
|
@Override
|
298
|
public void widgetSelected(SelectionEvent e) {
|
299
|
boolean isShowNameRelationship = showNameRelationship.getSelection();
|
300
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP, isShowNameRelationship);
|
301
|
}
|
302
|
});
|
303
|
|
304
|
if(isSimpleDetailsViewActivated){
|
305
|
child.setEnabled(true);
|
306
|
}else{
|
307
|
child.setEnabled(false);
|
308
|
}
|
309
|
|
310
|
|
311
|
|
312
|
// Label emptyLabel = new Label(getFieldEditorParent(), 0);
|
313
|
|
314
|
|
315
|
|
316
|
|
317
|
}
|
318
|
|
319
|
|
320
|
|
321
|
protected IPreferenceStore doGetPreferenceStore() {
|
322
|
return PreferencesUtil.getPreferenceStore();
|
323
|
}
|
324
|
|
325
|
/**
|
326
|
* @return
|
327
|
*/
|
328
|
private String[][] getLabelAndValues() {
|
329
|
List<NomenclaturalCode> supportedCodes = NomenclaturalCodeHelper
|
330
|
.getSupportedCodes();
|
331
|
labelAndValues = new String[supportedCodes.size()][2];
|
332
|
for (int i = 0; i < supportedCodes.size(); i++) {
|
333
|
labelAndValues[i][0] = NomenclaturalCodeHelper
|
334
|
.getDescription(supportedCodes.get(i));
|
335
|
labelAndValues[i][1] = PreferencesUtil
|
336
|
.getPreferenceKey(supportedCodes.get(i));
|
337
|
}
|
338
|
return labelAndValues;
|
339
|
}
|
340
|
|
341
|
|
342
|
/**
|
343
|
*
|
344
|
*/
|
345
|
void createNameDetailsViewConfig() {
|
346
|
config.setSimpleDetailsViewActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION));
|
347
|
config.setAppendedPhraseActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE));
|
348
|
config.setAtomisedEpithetsActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS));
|
349
|
config.setAuthorshipSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP));
|
350
|
config.setLSIDActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID));
|
351
|
config.setNameCacheActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_CACHE));
|
352
|
config.setNameRelationsSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP));
|
353
|
config.setNomenclaturalCodeActived(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE));
|
354
|
config.setNomenclaturalStatusSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS));
|
355
|
config.setNomenclaturalReferenceSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE));
|
356
|
config.setProtologueActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE));
|
357
|
config.setRankActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK));
|
358
|
config.setSimpleDetailsViewActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION));
|
359
|
config.setTaxonSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON));
|
360
|
config.setTypeDesignationSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION));
|
361
|
}
|
362
|
|
363
|
public void createNomenclaturalCodeTab(Composite parent){
|
364
|
composite = addTab("Nomenclatural Code");
|
365
|
nomenclaturalCodeCombo = new Combo(composite, SWT.READ_ONLY);
|
366
|
List<NomenclaturalCode> supportedCodes = NomenclaturalCodeHelper
|
367
|
.getSupportedCodes();
|
368
|
for (NomenclaturalCode code: supportedCodes) {
|
369
|
nomenclaturalCodeCombo.add(NomenclaturalCodeHelper
|
370
|
.getDescription(code));
|
371
|
|
372
|
}
|
373
|
getLabelAndValues();
|
374
|
//get the actual nomenclatural code and set it as selection: doGetPreferenceStore().getString(IPreferenceKeys.CDM_NOMENCLATURAL_CODE_KEY);
|
375
|
nomenclaturalCodeCombo.addSelectionListener(new SelectionAdapter() {
|
376
|
@Override
|
377
|
public void widgetSelected(SelectionEvent evt) {
|
378
|
|
379
|
String name = nomenclaturalCodeCombo.getText();
|
380
|
String selectedPreferenceKey = null;
|
381
|
for (String[] labelAndValue: labelAndValues){
|
382
|
if (labelAndValue[0].equals(name)){
|
383
|
selectedPreferenceKey = labelAndValue[1];
|
384
|
}
|
385
|
}
|
386
|
|
387
|
|
388
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.CDM_NOMENCLATURAL_CODE_KEY, selectedPreferenceKey);
|
389
|
|
390
|
}
|
391
|
});
|
392
|
nomenclaturalCodeLabel = new Label(composite, SWT.READ_ONLY);
|
393
|
|
394
|
|
395
|
final Button useLocalPreference = new Button(composite, SWT.CHECK);
|
396
|
boolean isUseLocalPreference = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY);
|
397
|
useLocalPreference.setText("allow to use local preference");
|
398
|
useLocalPreference.setSelection(isUseLocalPreference);
|
399
|
useLocalPreference.addSelectionListener(new SelectionAdapter(){
|
400
|
@Override
|
401
|
public void widgetSelected(SelectionEvent e) {
|
402
|
boolean isUseLocalPreference = useLocalPreference.getSelection();
|
403
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY, isUseLocalPreference);
|
404
|
}
|
405
|
});
|
406
|
|
407
|
|
408
|
|
409
|
|
410
|
}
|
411
|
|
412
|
|
413
|
public void createSpecimenOrObservationTab(Composite parent){
|
414
|
composite = addTab("Specimen or Observation");
|
415
|
|
416
|
final Button showCollectingAreaInGeneralSectionButton = new Button(composite, SWT.CHECK);
|
417
|
boolean isShowCollectingAreaInGeneralSection = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION);
|
418
|
showCollectingAreaInGeneralSectionButton.setText(Messages.DatabasePreferncesPage_Show_Collecting_Areas_in_general_section);
|
419
|
showCollectingAreaInGeneralSectionButton.setSelection(isShowCollectingAreaInGeneralSection);
|
420
|
showCollectingAreaInGeneralSectionButton.addSelectionListener(new SelectionAdapter(){
|
421
|
@Override
|
422
|
public void widgetSelected(SelectionEvent e) {
|
423
|
boolean isShowCollectingAreaInGeneralSection = showCollectingAreaInGeneralSectionButton.getSelection();
|
424
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION, isShowCollectingAreaInGeneralSection);
|
425
|
}
|
426
|
});
|
427
|
|
428
|
final Button determinationOnlyForFieldUnitsButton = new Button(composite, SWT.CHECK);
|
429
|
boolean isDeterminationOnlyForFieldUnits = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS);
|
430
|
determinationOnlyForFieldUnitsButton.setText(Messages.DatabasePreferncesPage_Determination_only_for_field_unnits);
|
431
|
determinationOnlyForFieldUnitsButton.setSelection(isDeterminationOnlyForFieldUnits);
|
432
|
determinationOnlyForFieldUnitsButton.addSelectionListener(new SelectionAdapter(){
|
433
|
@Override
|
434
|
public void widgetSelected(SelectionEvent e) {
|
435
|
boolean isDeterminationOnlyForFieldUnits = determinationOnlyForFieldUnitsButton.getSelection();
|
436
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS, isDeterminationOnlyForFieldUnits);
|
437
|
}
|
438
|
});
|
439
|
|
440
|
final Button showTaxonAssociationButton = new Button(composite, SWT.CHECK);
|
441
|
boolean isShowTaxonAssociation = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS);
|
442
|
showTaxonAssociationButton.setText(Messages.DatabasePreferncesPage_Taxon_Associations);
|
443
|
showTaxonAssociationButton.setSelection(isShowTaxonAssociation);
|
444
|
showTaxonAssociationButton.addSelectionListener(new SelectionAdapter(){
|
445
|
@Override
|
446
|
public void widgetSelected(SelectionEvent e) {
|
447
|
boolean isShowTaxonAssociation = showTaxonAssociationButton.getSelection();
|
448
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS, isShowTaxonAssociation);
|
449
|
}
|
450
|
});
|
451
|
|
452
|
|
453
|
|
454
|
}
|
455
|
|
456
|
/**
|
457
|
* {@inheritDoc}
|
458
|
*/
|
459
|
@Override
|
460
|
public boolean canFlipToNextPage() {
|
461
|
// TODO Auto-generated method stub
|
462
|
return false;
|
463
|
}
|
464
|
|
465
|
|
466
|
|
467
|
/**
|
468
|
* {@inheritDoc}
|
469
|
*/
|
470
|
@Override
|
471
|
public String getName() {
|
472
|
// TODO Auto-generated method stub
|
473
|
return null;
|
474
|
}
|
475
|
|
476
|
|
477
|
|
478
|
/**
|
479
|
* {@inheritDoc}
|
480
|
*/
|
481
|
@Override
|
482
|
public IWizardPage getNextPage() {
|
483
|
// TODO Auto-generated method stub
|
484
|
return null;
|
485
|
}
|
486
|
|
487
|
|
488
|
|
489
|
/**
|
490
|
* {@inheritDoc}
|
491
|
*/
|
492
|
@Override
|
493
|
public IWizardPage getPreviousPage() {
|
494
|
// TODO Auto-generated method stub
|
495
|
return null;
|
496
|
}
|
497
|
|
498
|
|
499
|
|
500
|
/**
|
501
|
* {@inheritDoc}
|
502
|
*/
|
503
|
@Override
|
504
|
public IWizard getWizard() {
|
505
|
// TODO Auto-generated method stub
|
506
|
return null;
|
507
|
}
|
508
|
|
509
|
|
510
|
|
511
|
/**
|
512
|
* {@inheritDoc}
|
513
|
*/
|
514
|
@Override
|
515
|
public boolean isPageComplete() {
|
516
|
|
517
|
return true;
|
518
|
}
|
519
|
|
520
|
|
521
|
|
522
|
/**
|
523
|
* {@inheritDoc}
|
524
|
*/
|
525
|
@Override
|
526
|
public void setPreviousPage(IWizardPage page) {
|
527
|
// TODO Auto-generated method stub
|
528
|
|
529
|
}
|
530
|
|
531
|
|
532
|
|
533
|
/**
|
534
|
* {@inheritDoc}
|
535
|
*/
|
536
|
@Override
|
537
|
public void setWizard(IWizard newWizard) {
|
538
|
// TODO Auto-generated method stub
|
539
|
|
540
|
}
|
541
|
|
542
|
/**
|
543
|
* {@inheritDoc}
|
544
|
*/
|
545
|
@Override
|
546
|
public void createControl(Composite parent) {
|
547
|
createNameDetailsConfiguration(parent);
|
548
|
createNomenclaturalCodeTab(parent);
|
549
|
|
550
|
createSpecimenOrObservationTab(parent);
|
551
|
setControl(parent);
|
552
|
}
|
553
|
|
554
|
/**
|
555
|
* @return
|
556
|
*/
|
557
|
public NameDetailsConfigurator getConfig() {
|
558
|
|
559
|
return config;
|
560
|
}
|
561
|
|
562
|
|
563
|
|
564
|
|
565
|
|
566
|
|
567
|
|
568
|
}
|