Project

General

Profile

Download (2.01 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2007 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

    
10
package eu.etaxonomy.taxeditor.preference;
11

    
12
import org.eclipse.core.expressions.PropertyTester;
13

    
14
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
15

    
16
/**
17
 * @author n.hoffmann
18
 * @created Jan 26, 2011
19
 * @version 1.0
20
 */
21
public class PreferencePropertyTester extends PropertyTester {
22

    
23

    
24
	private static final String SHOW_EXPERIMENTAL_FEATURES = "isShowExperimentalFeatures";
25

    
26
    private static final String SHOW_CHECKLIST_EDITOR = "isChecklistEditorEnabled";
27

    
28
    private static final String SHOW_IO_MENU = "isShowIOMenuEnabled";
29

    
30
    private static final String SHOW_SPECIMEN_MENU = "isShowSpecimenMenuEnabled";
31

    
32
	@Override
33
	public boolean test(Object receiver, String property, Object[] args,
34
			Object expectedValue) {
35
		if(SHOW_EXPERIMENTAL_FEATURES.equals(property)){
36
			return isShowExperimentalFeatures();
37
		}
38
	    if(SHOW_CHECKLIST_EDITOR.equals(property)){
39
	        return isChecklistEditorEnabled();
40
	    }
41
	    if(SHOW_IO_MENU.equals(property)){
42
	        boolean test = isShowIOMenuEnabled();
43
            return isShowIOMenuEnabled();
44
        }
45
	    if(SHOW_SPECIMEN_MENU.equals(property)){
46
            return isShowSpecimenMenuEnabled();
47
        }
48
		return false;
49
	}
50

    
51
	/**
52
	 * @return
53
	 */
54
	private boolean isShowExperimentalFeatures() {
55
		return PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_EXPERIMENTAL_FEATURES);
56
	}
57

    
58
	private boolean isChecklistEditorEnabled() {
59
        return PreferencesUtil.getBooleanValue(PreferencePredicate.DistributionEditorActivated.getKey());
60
    }
61
	private boolean isShowIOMenuEnabled() {
62
        return PreferencesUtil.getBooleanValue(PreferencePredicate.ShowImportExportMenu.getKey());
63
    }
64

    
65
	private boolean isShowSpecimenMenuEnabled() {
66
        return PreferencesUtil.getBooleanValue(PreferencePredicate.ShowSpecimen.getKey());
67
    }
68

    
69
}
(26-26/41)