Project

General

Profile

Download (1.47 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
* Copyright (C) 2007 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10

    
11
package eu.etaxonomy.taxeditor.preference;
12

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

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

    
22

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

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

    
27
	/* (non-Javadoc)
28
	 * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
29
	 */
30
	@Override
31
	public boolean test(Object receiver, String property, Object[] args,
32
			Object expectedValue) {
33

    
34
		if(SHOW_EXPERIMENTAL_FEATURES.equals(property)){
35
			return isShowExperimentalFeatures();
36
		}
37
	    if(SHOW_CHECKLIST_EDITOR.equals(property)){
38
	        return isChecklistEditorEnabled();
39
	    }
40

    
41
		return false;
42
	}
43

    
44
	/**
45
	 * @return
46
	 */
47
	private boolean isShowExperimentalFeatures() {
48
		return PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_EXPERIMENTAL_FEATURES);
49
	}
50

    
51
	private boolean isChecklistEditorEnabled() {
52
        return PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DISTRIBUTION_AREA_PREFRENCES_ACTIVE);
53
    }
54
}
(14-14/21)