1
|
/**
|
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.preference;
|
10
|
|
11
|
import org.eclipse.swt.SWT;
|
12
|
import org.eclipse.swt.events.SelectionAdapter;
|
13
|
import org.eclipse.swt.events.SelectionEvent;
|
14
|
import org.eclipse.swt.events.SelectionListener;
|
15
|
import org.eclipse.swt.layout.GridData;
|
16
|
import org.eclipse.swt.widgets.Button;
|
17
|
import org.eclipse.swt.widgets.Combo;
|
18
|
import org.eclipse.swt.widgets.Composite;
|
19
|
import org.eclipse.swt.widgets.Control;
|
20
|
import org.eclipse.swt.widgets.Label;
|
21
|
|
22
|
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
|
23
|
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
|
24
|
import eu.etaxonomy.taxeditor.l10n.Messages;
|
25
|
import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
|
26
|
|
27
|
/**
|
28
|
* @author k.luther
|
29
|
* @since 16.10.2018
|
30
|
*
|
31
|
*/
|
32
|
public class SearchDialogPreferences extends CdmPreferencePage implements SelectionListener {
|
33
|
|
34
|
protected CdmPreference showIdInSelectionDialogPref;
|
35
|
protected CdmPreference searchForIdentifierAsDefaultPref;
|
36
|
protected CdmPreference searchForIdentifierAndTitleCachePref;
|
37
|
protected CdmPreference sortTaxaByRankAndNamePref;
|
38
|
protected CdmPreference filterCommonNameReferencesPref;
|
39
|
|
40
|
|
41
|
protected Boolean showIdInSelectionDialog;
|
42
|
protected Boolean searchForIdentifierAsDefault;
|
43
|
protected Boolean searchForIdentifierAndTitleCache;
|
44
|
protected Boolean sortTaxaByRankAndName;
|
45
|
protected Boolean filterCommonNameReferences;
|
46
|
|
47
|
private boolean overrideShowIdInSelectionDialog = true;
|
48
|
private boolean overrideSearchForIdentifierAsDefault = true;
|
49
|
private boolean overrideSearchForIdentifierAndTitleCache = true;
|
50
|
private boolean overrideSortTaxaByRankAndName = true;
|
51
|
private boolean overrideFilterCommonNameReferences = true;
|
52
|
|
53
|
protected Combo showIdInSelectionDialogButton;
|
54
|
protected Button allowOverrideIsShowIdInSelectionDialogButton;
|
55
|
protected Combo searchForIdentifierAsDefaultButton;
|
56
|
protected Button allowOverrideSearchForIdentifierAsDefaultButton;
|
57
|
protected Combo searchForIdentifierAndTitleCacheButton;
|
58
|
protected Button allowOverridesSearchForIdentifierAndTitleCacheButton;
|
59
|
protected Combo sortTaxaByRankAndNameButton;
|
60
|
protected Button allowOverrideIsSortTaxaByRankAndNameButton;
|
61
|
protected Combo filterCommonNameReferenceButton;
|
62
|
protected Button allowOverrideFilterCommonNameReferencesButton;
|
63
|
|
64
|
|
65
|
|
66
|
@Override
|
67
|
public void getValues(){
|
68
|
|
69
|
showIdInSelectionDialogPref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowIdInSelectionDialog);
|
70
|
searchForIdentifierAsDefaultPref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.SearchForIdentifierAsDefault);
|
71
|
searchForIdentifierAndTitleCachePref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.SearchForIdentifierAndTitleCache);
|
72
|
sortTaxaByRankAndNamePref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.SortTaxaByRankAndName);
|
73
|
filterCommonNameReferencesPref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.CommonNameReferencesWithMarker);
|
74
|
|
75
|
overrideShowIdInSelectionDialog = PreferencesUtil.getBooleanValue(PreferencesUtil.createOverridePreferenceString(PreferencePredicate.ShowIdInSelectionDialog.getKey()));
|
76
|
overrideSearchForIdentifierAsDefault = PreferencesUtil.getBooleanValue(PreferencesUtil.createOverridePreferenceString(PreferencePredicate.SearchForIdentifierAsDefault.getKey()));
|
77
|
overrideSearchForIdentifierAndTitleCache = PreferencesUtil.getBooleanValue(PreferencesUtil.createOverridePreferenceString(PreferencePredicate.SearchForIdentifierAndTitleCache.getKey()));
|
78
|
overrideSortTaxaByRankAndName = PreferencesUtil.getBooleanValue(PreferencesUtil.createOverridePreferenceString(PreferencePredicate.SortTaxaByRankAndName.getKey()));
|
79
|
overrideFilterCommonNameReferences = PreferencesUtil.getBooleanValue(PreferencesUtil.createOverridePreferenceString(PreferencePredicate.CommonNameReferencesWithMarker.getKey()));
|
80
|
if(overrideShowIdInSelectionDialog){
|
81
|
showIdInSelectionDialog = PreferencesUtil.getBooleanValue(PreferencePredicate.ShowIdInSelectionDialog.getKey(), true);
|
82
|
}
|
83
|
if(overrideSearchForIdentifierAsDefault){
|
84
|
searchForIdentifierAsDefault = PreferencesUtil.getBooleanValue(PreferencePredicate.SearchForIdentifierAsDefault.getKey(), true);
|
85
|
}
|
86
|
if(overrideSearchForIdentifierAndTitleCache){
|
87
|
searchForIdentifierAndTitleCache = PreferencesUtil.getBooleanValue(PreferencePredicate.SearchForIdentifierAndTitleCache.getKey(), true);
|
88
|
}
|
89
|
if(overrideSortTaxaByRankAndName){
|
90
|
sortTaxaByRankAndName = PreferencesUtil.getBooleanValue(PreferencePredicate.SortTaxaByRankAndName.getKey(), true);
|
91
|
}
|
92
|
if(overrideFilterCommonNameReferences){
|
93
|
filterCommonNameReferences = PreferencesUtil.getBooleanValue(PreferencePredicate.CommonNameReferencesWithMarker.getKey(), true);
|
94
|
}
|
95
|
|
96
|
|
97
|
}
|
98
|
|
99
|
|
100
|
|
101
|
@Override
|
102
|
public void widgetSelected(SelectionEvent e) {
|
103
|
setApply(true);
|
104
|
if (e.getSource().equals(this.showIdInSelectionDialogButton)) {
|
105
|
String text = showIdInSelectionDialogButton.getText();
|
106
|
if(text.startsWith(Messages.Preference_Use_Default)){
|
107
|
showIdInSelectionDialog = null;
|
108
|
return;
|
109
|
}
|
110
|
|
111
|
if (text.equals(Messages.GeneralPreference_yes)){
|
112
|
showIdInSelectionDialog = true;
|
113
|
}else{
|
114
|
showIdInSelectionDialog = false;
|
115
|
}
|
116
|
}
|
117
|
|
118
|
if (e.getSource().equals(this.searchForIdentifierAsDefaultButton)) {
|
119
|
String text = searchForIdentifierAsDefaultButton.getText();
|
120
|
if(text.startsWith(Messages.Preference_Use_Default)){
|
121
|
searchForIdentifierAsDefault = null;
|
122
|
return;
|
123
|
}
|
124
|
|
125
|
if (text.equals(Messages.GeneralPreference_yes)){
|
126
|
searchForIdentifierAsDefault = true;
|
127
|
}else{
|
128
|
searchForIdentifierAsDefault = false;
|
129
|
}
|
130
|
}
|
131
|
|
132
|
if (e.getSource().equals(this.searchForIdentifierAndTitleCacheButton)) {
|
133
|
String text = searchForIdentifierAndTitleCacheButton.getText();
|
134
|
if(text.startsWith(Messages.Preference_Use_Default)){
|
135
|
searchForIdentifierAndTitleCache = null;
|
136
|
return;
|
137
|
}
|
138
|
|
139
|
if (text.equals(Messages.GeneralPreference_yes)){
|
140
|
searchForIdentifierAndTitleCache = true;
|
141
|
}else{
|
142
|
searchForIdentifierAndTitleCache = false;
|
143
|
}
|
144
|
}
|
145
|
|
146
|
if (e.getSource().equals(this.sortTaxaByRankAndNameButton)) {
|
147
|
String text = sortTaxaByRankAndNameButton.getText();
|
148
|
if(text.startsWith(Messages.Preference_Use_Default)){
|
149
|
sortTaxaByRankAndName = null;
|
150
|
return;
|
151
|
}
|
152
|
|
153
|
if (text.equals(Messages.GeneralPreference_yes)){
|
154
|
sortTaxaByRankAndName = true;
|
155
|
}else{
|
156
|
sortTaxaByRankAndName = false;
|
157
|
}
|
158
|
}
|
159
|
|
160
|
if (e.getSource().equals(this.filterCommonNameReferenceButton)) {
|
161
|
String text = filterCommonNameReferenceButton.getText();
|
162
|
if(text.startsWith(Messages.Preference_Use_Default)){
|
163
|
filterCommonNameReferences = null;
|
164
|
return;
|
165
|
}
|
166
|
|
167
|
if (text.equals(Messages.GeneralPreference_yes)){
|
168
|
filterCommonNameReferences = true;
|
169
|
}else{
|
170
|
filterCommonNameReferences = false;
|
171
|
}
|
172
|
}
|
173
|
|
174
|
|
175
|
}
|
176
|
|
177
|
@Override
|
178
|
public void widgetDefaultSelected(SelectionEvent e) {
|
179
|
// TODO Auto-generated method stub
|
180
|
|
181
|
}
|
182
|
|
183
|
@Override
|
184
|
protected Control createContents(Composite parent) {
|
185
|
getValues();
|
186
|
|
187
|
Composite titleComp = createComposite(parent);
|
188
|
GridData gridData = createTextGridData();
|
189
|
|
190
|
Label separator= new Label(titleComp, SWT.HORIZONTAL | SWT.SEPARATOR);
|
191
|
separator.setLayoutData(gridData);
|
192
|
separator.setVisible(false);
|
193
|
showIdInSelectionDialogButton = createBooleanCombo(titleComp, Messages.GeneralPreference_yes, Messages.GeneralPreference_no, PreferencePredicate.ShowIdInSelectionDialog, Messages.DatabasePreferncesPage_Show_Id_In_SelectionDialog, isAdminPreference);
|
194
|
|
195
|
showIdInSelectionDialogButton.addSelectionListener(this);
|
196
|
|
197
|
if (!isAdminPreference && showIdInSelectionDialogPref != null){
|
198
|
showIdInSelectionDialogButton.setEnabled(showIdInSelectionDialogPref.isAllowOverride());
|
199
|
}
|
200
|
|
201
|
if (isAdminPreference){
|
202
|
allowOverrideIsShowIdInSelectionDialogButton = createAllowOverrideButton(titleComp);
|
203
|
allowOverrideIsShowIdInSelectionDialogButton.setSelection(showIdInSelectionDialogPref != null? showIdInSelectionDialogPref.isAllowOverride(): true);
|
204
|
allowOverrideIsShowIdInSelectionDialogButton.addSelectionListener(new SelectionAdapter(){
|
205
|
@Override
|
206
|
public void widgetSelected(SelectionEvent e) {
|
207
|
setApply(true);
|
208
|
if (showIdInSelectionDialogPref == null){
|
209
|
showIdInSelectionDialogPref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.ShowIdInSelectionDialog, null);
|
210
|
}
|
211
|
showIdInSelectionDialogPref.setAllowOverride(allowOverrideIsShowIdInSelectionDialogButton.getSelection());
|
212
|
}
|
213
|
});
|
214
|
}
|
215
|
|
216
|
Composite composite = createComposite(parent);
|
217
|
//composite.setEnabled(isShowSpecimenRelatedIssues);
|
218
|
gridData = createTextGridData();
|
219
|
|
220
|
separator= new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
|
221
|
separator.setLayoutData(gridData);
|
222
|
|
223
|
searchForIdentifierAsDefaultButton = createBooleanCombo(composite, Messages.GeneralPreference_yes, Messages.GeneralPreference_no, PreferencePredicate.SearchForIdentifierAsDefault, Messages.DatabasePreferncesPage_Search_for_identifier_as_default, isAdminPreference);
|
224
|
|
225
|
searchForIdentifierAsDefaultButton.addSelectionListener(this);
|
226
|
|
227
|
if (isAdminPreference){
|
228
|
allowOverrideSearchForIdentifierAsDefaultButton = createAllowOverrideButton(composite);
|
229
|
allowOverrideSearchForIdentifierAsDefaultButton.setSelection(searchForIdentifierAsDefaultPref != null?searchForIdentifierAsDefaultPref.isAllowOverride(): true);
|
230
|
allowOverrideSearchForIdentifierAsDefaultButton.addSelectionListener(new SelectionAdapter(){
|
231
|
@Override
|
232
|
public void widgetSelected(SelectionEvent e) {
|
233
|
setApply(true);
|
234
|
if (searchForIdentifierAsDefaultPref == null && !allowOverrideSearchForIdentifierAsDefaultButton.getSelection()){
|
235
|
searchForIdentifierAsDefaultPref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.SearchForIdentifierAsDefault, null);
|
236
|
}
|
237
|
searchForIdentifierAsDefaultPref.setAllowOverride(allowOverrideSearchForIdentifierAsDefaultButton.getSelection());
|
238
|
}
|
239
|
});
|
240
|
}
|
241
|
if(!isAdminPreference && searchForIdentifierAsDefaultPref != null){
|
242
|
searchForIdentifierAsDefaultButton.setEnabled(searchForIdentifierAsDefaultPref.isAllowOverride());
|
243
|
}
|
244
|
|
245
|
searchForIdentifierAndTitleCacheButton = createBooleanCombo(composite, Messages.GeneralPreference_yes, Messages.GeneralPreference_no, PreferencePredicate.SearchForIdentifierAndTitleCache, Messages.DatabasePreferncesPage_search_for_identifier_and_titleCache, isAdminPreference);
|
246
|
searchForIdentifierAndTitleCacheButton.addSelectionListener(this);
|
247
|
|
248
|
if(!isAdminPreference && searchForIdentifierAndTitleCachePref != null){
|
249
|
searchForIdentifierAndTitleCacheButton.setEnabled(searchForIdentifierAndTitleCachePref.isAllowOverride());
|
250
|
}
|
251
|
|
252
|
if (isAdminPreference){
|
253
|
allowOverridesSearchForIdentifierAndTitleCacheButton = createAllowOverrideButton(composite);
|
254
|
allowOverridesSearchForIdentifierAndTitleCacheButton.setSelection(searchForIdentifierAndTitleCachePref != null?searchForIdentifierAndTitleCachePref.isAllowOverride():true);
|
255
|
allowOverridesSearchForIdentifierAndTitleCacheButton.addSelectionListener(new SelectionAdapter(){
|
256
|
@Override
|
257
|
public void widgetSelected(SelectionEvent e) {
|
258
|
setApply(true);
|
259
|
if (searchForIdentifierAndTitleCachePref == null && !allowOverridesSearchForIdentifierAndTitleCacheButton.getSelection()){
|
260
|
searchForIdentifierAndTitleCachePref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.SearchForIdentifierAndTitleCache, null);
|
261
|
}
|
262
|
searchForIdentifierAndTitleCachePref.setAllowOverride(allowOverridesSearchForIdentifierAndTitleCacheButton.getSelection());
|
263
|
}
|
264
|
});
|
265
|
}
|
266
|
|
267
|
sortTaxaByRankAndNameButton =createBooleanCombo(composite, Messages.GeneralPreference_yes, Messages.GeneralPreference_no, PreferencePredicate.SortTaxaByRankAndName, Messages.DatabasePreferncesPage_Sort_Taxa_By_Name_And_Rank, isAdminPreference);
|
268
|
|
269
|
|
270
|
sortTaxaByRankAndNameButton.addSelectionListener(this);
|
271
|
|
272
|
if ( !isAdminPreference && sortTaxaByRankAndNamePref != null){
|
273
|
sortTaxaByRankAndNameButton.setEnabled(sortTaxaByRankAndNamePref.isAllowOverride());
|
274
|
}
|
275
|
|
276
|
if (isAdminPreference){
|
277
|
allowOverrideIsSortTaxaByRankAndNameButton = createAllowOverrideButton(composite);
|
278
|
allowOverrideIsSortTaxaByRankAndNameButton.setSelection(sortTaxaByRankAndNamePref != null? sortTaxaByRankAndNamePref.isAllowOverride(): true);
|
279
|
allowOverrideIsSortTaxaByRankAndNameButton.addSelectionListener(new SelectionAdapter(){
|
280
|
@Override
|
281
|
public void widgetSelected(SelectionEvent e) {
|
282
|
setApply(true);
|
283
|
if (sortTaxaByRankAndNamePref == null && !allowOverrideIsSortTaxaByRankAndNameButton.getSelection()){
|
284
|
sortTaxaByRankAndNamePref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.SortTaxaByRankAndName, null);
|
285
|
}
|
286
|
sortTaxaByRankAndNamePref.setAllowOverride(allowOverrideIsSortTaxaByRankAndNameButton.getSelection());
|
287
|
}
|
288
|
});
|
289
|
}
|
290
|
|
291
|
filterCommonNameReferenceButton = createBooleanCombo(composite, Messages.GeneralPreference_yes, Messages.GeneralPreference_no, PreferencePredicate.CommonNameReferencesWithMarker, Messages.DatabasePreferncesPage_CommonNameFilter, isAdminPreference);
|
292
|
filterCommonNameReferenceButton.addSelectionListener(this);
|
293
|
|
294
|
|
295
|
if (!isAdminPreference && filterCommonNameReferencesPref != null){
|
296
|
filterCommonNameReferenceButton.setEnabled(filterCommonNameReferencesPref.isAllowOverride());
|
297
|
}
|
298
|
|
299
|
if (isAdminPreference){
|
300
|
allowOverrideFilterCommonNameReferencesButton = createAllowOverrideButton(composite);
|
301
|
allowOverrideFilterCommonNameReferencesButton.setSelection(filterCommonNameReferencesPref != null? filterCommonNameReferencesPref.isAllowOverride():true);
|
302
|
allowOverrideFilterCommonNameReferencesButton.addSelectionListener(new SelectionAdapter(){
|
303
|
@Override
|
304
|
public void widgetSelected(SelectionEvent e) {
|
305
|
setApply(true);
|
306
|
if (filterCommonNameReferencesPref == null && !allowOverrideFilterCommonNameReferencesButton.getSelection()){
|
307
|
filterCommonNameReferencesPref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.CommonNameReferencesWithMarker, null);
|
308
|
}
|
309
|
filterCommonNameReferencesPref.setAllowOverride(allowOverrideFilterCommonNameReferencesButton.getSelection());
|
310
|
}
|
311
|
});
|
312
|
}
|
313
|
|
314
|
setSelections();
|
315
|
|
316
|
return composite;
|
317
|
}
|
318
|
|
319
|
@Override
|
320
|
protected void performDefaults() {
|
321
|
showIdInSelectionDialogButton.select(0);
|
322
|
showIdInSelectionDialog = null;
|
323
|
if (isAdminPreference){
|
324
|
allowOverrideIsShowIdInSelectionDialogButton.setSelection(true);
|
325
|
showIdInSelectionDialogPref.setAllowOverride(true);
|
326
|
}
|
327
|
searchForIdentifierAsDefaultButton.select(0);
|
328
|
searchForIdentifierAsDefault = null;
|
329
|
if (isAdminPreference){
|
330
|
allowOverrideSearchForIdentifierAsDefaultButton.setSelection(true);
|
331
|
searchForIdentifierAsDefaultPref.setAllowOverride(true);
|
332
|
}
|
333
|
searchForIdentifierAndTitleCacheButton.select(0);
|
334
|
searchForIdentifierAndTitleCache = null;
|
335
|
if (isAdminPreference){
|
336
|
allowOverridesSearchForIdentifierAndTitleCacheButton.setSelection(true);
|
337
|
searchForIdentifierAndTitleCachePref.setAllowOverride(true);
|
338
|
}
|
339
|
sortTaxaByRankAndNameButton.select(0);
|
340
|
sortTaxaByRankAndName = null;
|
341
|
if (isAdminPreference){
|
342
|
allowOverrideIsSortTaxaByRankAndNameButton.setSelection(true);
|
343
|
sortTaxaByRankAndNamePref.setAllowOverride(true);
|
344
|
}
|
345
|
filterCommonNameReferenceButton.select(0);
|
346
|
filterCommonNameReferences = null;
|
347
|
if (isAdminPreference){
|
348
|
allowOverrideFilterCommonNameReferencesButton.setSelection(true);
|
349
|
filterCommonNameReferencesPref.setAllowOverride(true);
|
350
|
}
|
351
|
setApply(true);
|
352
|
}
|
353
|
|
354
|
@Override
|
355
|
public boolean performOk(){
|
356
|
if (!isApply()){
|
357
|
return true;
|
358
|
}
|
359
|
boolean override = false;
|
360
|
if (showIdInSelectionDialog != null ) {
|
361
|
override = true;
|
362
|
PreferencesUtil.setStringValue(PreferencePredicate.ShowIdInSelectionDialog.getKey(), showIdInSelectionDialog.toString());
|
363
|
}
|
364
|
PreferencesUtil.setBooleanValue(
|
365
|
PreferencesUtil.prefOverrideKey(PreferencePredicate.ShowIdInSelectionDialog.getKey()),
|
366
|
override);
|
367
|
|
368
|
override = false;
|
369
|
|
370
|
if(searchForIdentifierAsDefault != null){
|
371
|
override = true;
|
372
|
PreferencesUtil.setStringValue(PreferencePredicate.SearchForIdentifierAsDefault.getKey(), searchForIdentifierAsDefault.toString());
|
373
|
}
|
374
|
PreferencesUtil.setBooleanValue(
|
375
|
PreferencesUtil.prefOverrideKey(PreferencePredicate.SearchForIdentifierAsDefault.getKey()),
|
376
|
override);
|
377
|
override = false;
|
378
|
|
379
|
if(searchForIdentifierAndTitleCache != null){
|
380
|
override = true;
|
381
|
PreferencesUtil.setStringValue(PreferencePredicate.SearchForIdentifierAndTitleCache.getKey(), searchForIdentifierAndTitleCache.toString());
|
382
|
}
|
383
|
PreferencesUtil.setBooleanValue(
|
384
|
PreferencesUtil.prefOverrideKey(PreferencePredicate.SearchForIdentifierAndTitleCache.getKey()),
|
385
|
override);
|
386
|
override = false;
|
387
|
|
388
|
if(sortTaxaByRankAndName != null){
|
389
|
override = true;
|
390
|
PreferencesUtil.setStringValue(PreferencePredicate.SortTaxaByRankAndName.getKey(), sortTaxaByRankAndName.toString());
|
391
|
}
|
392
|
PreferencesUtil.setBooleanValue(
|
393
|
PreferencesUtil.prefOverrideKey(PreferencePredicate.SortTaxaByRankAndName.getKey()),
|
394
|
override);
|
395
|
override = false;
|
396
|
|
397
|
|
398
|
if(filterCommonNameReferences != null){
|
399
|
override = true;
|
400
|
PreferencesUtil.setStringValue(PreferencePredicate.CommonNameReferencesWithMarker.getKey(), filterCommonNameReferences.toString());
|
401
|
}
|
402
|
PreferencesUtil.setBooleanValue(
|
403
|
PreferencesUtil.prefOverrideKey(PreferencePredicate.CommonNameReferencesWithMarker.getKey()),
|
404
|
override);
|
405
|
override = false;
|
406
|
|
407
|
return true;
|
408
|
}
|
409
|
|
410
|
protected void setSelections(){
|
411
|
|
412
|
int index = 0;
|
413
|
for (String itemLabel : showIdInSelectionDialogButton.getItems()) {
|
414
|
if (itemLabel.startsWith(Messages.Preference_Use_Default) && (showIdInSelectionDialog == null || (!overrideShowIdInSelectionDialog && !isAdminPreference))) {
|
415
|
showIdInSelectionDialogButton.select(index);
|
416
|
break;
|
417
|
}
|
418
|
if (itemLabel.equals(Messages.GeneralPreference_yes) && showIdInSelectionDialog){
|
419
|
showIdInSelectionDialogButton.select(index);
|
420
|
break;
|
421
|
}
|
422
|
if (itemLabel.equals(Messages.GeneralPreference_no) && !showIdInSelectionDialog){
|
423
|
showIdInSelectionDialogButton.select(index);
|
424
|
break;
|
425
|
}
|
426
|
index++;
|
427
|
}
|
428
|
|
429
|
index = 0;
|
430
|
for (String itemLabel : searchForIdentifierAsDefaultButton.getItems()) {
|
431
|
if ((searchForIdentifierAsDefault == null || (!overrideSearchForIdentifierAsDefault && !isAdminPreference)) && itemLabel.startsWith(Messages.Preference_Use_Default)) {
|
432
|
searchForIdentifierAsDefaultButton.select(index);
|
433
|
break;
|
434
|
}
|
435
|
if (searchForIdentifierAsDefault != null && itemLabel.equals(Messages.GeneralPreference_yes) && searchForIdentifierAsDefault){
|
436
|
searchForIdentifierAsDefaultButton.select(index);
|
437
|
break;
|
438
|
}
|
439
|
if (searchForIdentifierAsDefault != null && itemLabel.equals(Messages.GeneralPreference_no) && !searchForIdentifierAsDefault){
|
440
|
searchForIdentifierAsDefaultButton.select(index);
|
441
|
break;
|
442
|
}
|
443
|
index++;
|
444
|
}
|
445
|
|
446
|
index = 0;
|
447
|
for (String itemLabel : searchForIdentifierAndTitleCacheButton.getItems()) {
|
448
|
if ((searchForIdentifierAndTitleCache == null || (!overrideSearchForIdentifierAndTitleCache && !isAdminPreference))&& itemLabel.startsWith(Messages.Preference_Use_Default)) {
|
449
|
searchForIdentifierAndTitleCacheButton.select(index);
|
450
|
break;
|
451
|
}
|
452
|
if (searchForIdentifierAndTitleCache != null && itemLabel.equals(Messages.GeneralPreference_yes) && searchForIdentifierAndTitleCache){
|
453
|
searchForIdentifierAndTitleCacheButton.select(index);
|
454
|
break;
|
455
|
}
|
456
|
if (searchForIdentifierAndTitleCache != null && itemLabel.equals(Messages.GeneralPreference_no) && !searchForIdentifierAndTitleCache){
|
457
|
searchForIdentifierAndTitleCacheButton.select(index);
|
458
|
break;
|
459
|
}
|
460
|
index++;
|
461
|
}
|
462
|
|
463
|
index = 0;
|
464
|
for (String itemLabel : sortTaxaByRankAndNameButton.getItems()) {
|
465
|
if ((sortTaxaByRankAndName == null || (!overrideSortTaxaByRankAndName && !isAdminPreference))&& itemLabel.startsWith(Messages.Preference_Use_Default)) {
|
466
|
sortTaxaByRankAndNameButton.select(index);
|
467
|
break;
|
468
|
}
|
469
|
if (sortTaxaByRankAndName != null && itemLabel.equals(Messages.GeneralPreference_yes) && sortTaxaByRankAndName){
|
470
|
sortTaxaByRankAndNameButton.select(index);
|
471
|
break;
|
472
|
}
|
473
|
if (sortTaxaByRankAndName != null && itemLabel.equals(Messages.GeneralPreference_no) && !sortTaxaByRankAndName){
|
474
|
sortTaxaByRankAndNameButton.select(index);
|
475
|
break;
|
476
|
}
|
477
|
index++;
|
478
|
}
|
479
|
|
480
|
index = 0;
|
481
|
for (String itemLabel: filterCommonNameReferenceButton.getItems()) {
|
482
|
if ((filterCommonNameReferences == null || (!overrideFilterCommonNameReferences && !isAdminPreference)) && itemLabel.startsWith(Messages.Preference_Use_Default)) {
|
483
|
filterCommonNameReferenceButton.select(index);
|
484
|
break;
|
485
|
}
|
486
|
if (filterCommonNameReferences != null && itemLabel.equals(Messages.GeneralPreference_yes) && filterCommonNameReferences){
|
487
|
filterCommonNameReferenceButton.select(index);
|
488
|
break;
|
489
|
}
|
490
|
if (filterCommonNameReferences != null && itemLabel.equals(Messages.GeneralPreference_no) && !filterCommonNameReferences){
|
491
|
filterCommonNameReferenceButton.select(index);
|
492
|
break;
|
493
|
}
|
494
|
index++;
|
495
|
}
|
496
|
}
|
497
|
|
498
|
|
499
|
}
|