2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.taxeditor
.preference
;
12 import org
.eclipse
.core
.expressions
.PropertyTester
;
14 import eu
.etaxonomy
.cdm
.model
.metadata
.PreferencePredicate
;
18 * @created Jan 26, 2011
21 public class PreferencePropertyTester
extends PropertyTester
{
24 private static final String SHOW_EXPERIMENTAL_FEATURES
= "isShowExperimentalFeatures";
26 private static final String SHOW_CHECKLIST_EDITOR
= "isChecklistEditorEnabled";
28 private static final String SHOW_IO_MENU
= "isShowIOMenuEnabled";
30 private static final String SHOW_SPECIMEN_MENU
= "isShowSpecimenMenuEnabled";
32 private static final String SHOW_SPECIMEN_LIST_MENU
= "isShowSpecimenListMenuEnabled";
35 public boolean test(Object receiver
, String property
, Object
[] args
,
36 Object expectedValue
) {
37 if(SHOW_EXPERIMENTAL_FEATURES
.equals(property
)){
38 return isShowExperimentalFeatures();
40 if(SHOW_CHECKLIST_EDITOR
.equals(property
)){
41 return isChecklistEditorEnabled();
43 if(SHOW_IO_MENU
.equals(property
)){
44 // boolean test = isShowIOMenuEnabled();
45 return isShowIOMenuEnabled();
47 if(SHOW_SPECIMEN_MENU
.equals(property
)){
48 return isShowSpecimenMenuEnabled();
50 if(SHOW_SPECIMEN_LIST_MENU
.equals(property
)){
51 return isShowSpecimenListMenuEnabled();
59 private boolean isShowExperimentalFeatures() {
60 return PreferencesUtil
.getBooleanValue(IPreferenceKeys
.SHOW_EXPERIMENTAL_FEATURES
);
63 private boolean isChecklistEditorEnabled() {
64 return PreferencesUtil
.getBooleanValue(PreferencePredicate
.DistributionEditorActivated
.getKey());
66 private boolean isShowIOMenuEnabled() {
67 return PreferencesUtil
.getBooleanValue(PreferencePredicate
.ShowImportExportMenu
.getKey());
70 private boolean isShowSpecimenMenuEnabled() {
71 return PreferencesUtil
.getBooleanValue(PreferencePredicate
.ShowSpecimen
.getKey());
74 private boolean isShowSpecimenListMenuEnabled() {
75 return PreferencesUtil
.getBooleanValue(PreferencePredicate
.ShowSpecimen
.getKey()) && PreferencesUtil
.getBooleanValue(PreferencePredicate
.ShowSpecimenListEditor
.getKey());