Project

General

Profile

Download (1.86 KB) Statistics
| Branch: | Tag: | Revision:
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(IPreferenceKeys.TAXON_SERVICE_CONFIGURATOR_TAXA)) {
38
            // initializes the search configurator
39
            PreferencesUtil.initializeSearchConfigurator();
40
        }
41

    
42
        switch (this) {
43
        case TAXON:
44
            boolean result = PreferencesUtil.getPreferenceStore().getBoolean(
45
                    IPreferenceKeys.TAXON_SERVICE_CONFIGURATOR_TAXA);
46
            return result;
47
        case SYNONYM:
48
            return PreferencesUtil.getPreferenceStore().getBoolean(
49
                    IPreferenceKeys.TAXON_SERVICE_CONFIGURATOR_SYNONYMS);
50
        case NAME:
51
            return PreferencesUtil.getPreferenceStore().getBoolean(
52
                    IPreferenceKeys.TAXON_SERVICE_CONFIGURATOR_NAMES);
53
        case COMMON_NAME:
54
            return PreferencesUtil.getPreferenceStore().getBoolean(
55
                    IPreferenceKeys.TAXON_SERVICE_CONFIGURATOR_COMMON_NAMES);
56
        }
57

    
58
        return true;
59
    }
60

    
61
}
(2-2/3)