1
|
/**
|
2
|
* Copyright (C) 2017 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.navigation.search;
|
10
|
|
11
|
import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
|
12
|
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
|
13
|
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
|
14
|
|
15
|
/**
|
16
|
* @author pplitzner
|
17
|
* @since Sep 27, 2017
|
18
|
*
|
19
|
*/
|
20
|
public enum SearchOption {
|
21
|
TAXON(Messages.SearchBar_6),
|
22
|
SYNONYM(Messages.SearchBar_7),
|
23
|
NAME(Messages.SearchBar_8),
|
24
|
COMMON_NAME(Messages.SearchBar_9);
|
25
|
|
26
|
private final String label;
|
27
|
|
28
|
private SearchOption(String label) {
|
29
|
this.label = label;
|
30
|
}
|
31
|
|
32
|
public String getLabel() {
|
33
|
return label;
|
34
|
}
|
35
|
|
36
|
public boolean getPreference() {
|
37
|
if (!PreferencesUtil.getPreferenceStore().contains(
|
38
|
IPreferenceKeys.TAXON_SERVICE_CONFIGURATOR_TAXA)) {
|
39
|
// initializes the search configurator
|
40
|
PreferencesUtil.initializeSearchConfigurator();
|
41
|
}
|
42
|
|
43
|
switch (this) {
|
44
|
case TAXON:
|
45
|
boolean result = PreferencesUtil.getPreferenceStore().getBoolean(
|
46
|
IPreferenceKeys.TAXON_SERVICE_CONFIGURATOR_TAXA);
|
47
|
return result;
|
48
|
case SYNONYM:
|
49
|
return PreferencesUtil.getPreferenceStore().getBoolean(
|
50
|
IPreferenceKeys.TAXON_SERVICE_CONFIGURATOR_SYNONYMS);
|
51
|
case NAME:
|
52
|
return PreferencesUtil.getPreferenceStore().getBoolean(
|
53
|
IPreferenceKeys.TAXON_SERVICE_CONFIGURATOR_NAMES);
|
54
|
case COMMON_NAME:
|
55
|
return PreferencesUtil.getPreferenceStore().getBoolean(
|
56
|
IPreferenceKeys.TAXON_SERVICE_CONFIGURATOR_COMMON_NAMES);
|
57
|
}
|
58
|
|
59
|
return true;
|
60
|
}
|
61
|
|
62
|
}
|