Example usage for org.eclipse.jface.preference IPreferenceStore contains

List of usage examples for org.eclipse.jface.preference IPreferenceStore contains

Introduction

In this page you can find the example usage for org.eclipse.jface.preference IPreferenceStore contains.

Prototype

boolean contains(String name);

Source Link

Document

Returns whether the named preference is known to this preference store.

Usage

From source file:org.eclipse.jst.jsf.validation.internal.ELValidationPreferences.java

License:Open Source License

/**
 * Loads the object from the preference store provided
 * /*from   ww  w  .j  av  a  2  s  . c o  m*/
 * @param prefStore
 */
public void load(IPreferenceStore prefStore) {
    if (!prefStore.contains(KEY_ENABLE_BUILD_VALIDATION)) {
        prefStore.setDefault(KEY_ENABLE_BUILD_VALIDATION, DEFAULT_ENABLE_BUILD_VALIDATION);
    }
    _enableBuildValidation = prefStore.getBoolean(KEY_ENABLE_BUILD_VALIDATION);

    if (!prefStore.contains(KEY_ENABLE_INCREMENTAL_VALIDATION)) {
        prefStore.setDefault(KEY_ENABLE_INCREMENTAL_VALIDATION, DEFAULT_ENABLE_INCREMENTAL_VALIDATION);
    }
    _enableIncrementalValidation = prefStore.getBoolean(KEY_ENABLE_INCREMENTAL_VALIDATION);

    loadSeverities(prefStore);
}

From source file:org.eclipse.jst.jsf.validation.internal.ELValidationPreferences.java

License:Open Source License

private void loadSeverities(final IPreferenceStore prefStore) {
    final int severities[] = getSeverities();

    for (int i = 0; i < DiagnosticFactory.NUM_IDS; i++) {
        final String key = getKeyById(i);

        if (!prefStore.contains(key)) {
            final int diagSeverity = getDefaultSeverity(i);
            final Severity severity = mapDiagToSeverity(diagSeverity);

            prefStore.setDefault(key, severity.toString());
        }// w  ww  .  ja  v a 2  s  .c  o  m
        final String storedSeverity = prefStore.getString(key);
        severities[i] = mapSeverityToDiag(storedSeverity);
    }
}

From source file:org.eclipse.jst.jsf.validation.internal.facelet.FaceletValidationPreferences.java

License:Open Source License

private void loadSeverities(final IPreferenceStore prefStore) {
    final int severities[] = getSeverities();
    for (int i = 0; i < FaceletDiagnosticFactory.NUM_IDS; i++) {
        final String key = getKeyById(i);
        if (!prefStore.contains(key)) {
            final int diagSeverity = getDefaultSeverity(i);
            final Severity severity = mapDiagToSeverity(diagSeverity);
            prefStore.setDefault(key, severity.toString());
        }/*from   w  ww .  j ava  2  s .c o m*/
        final String storedSeverity = prefStore.getString(key);
        severities[i] = mapSeverityToDiag(storedSeverity);
    }
}

From source file:org.eclipse.jst.jsf.validation.internal.JSFTypeComparatorPreferences.java

License:Open Source License

private void loadSeverities(final IPreferenceStore prefStore) {
    final int severities[] = getSeverities();

    for (int i = 0; i < TypeComparatorDiagnosticFactory.NUM_IDS; i++) {
        final String key = getKeyById(i);

        if (!prefStore.contains(key)) {
            final int diagSeverity = getDefaultSeverity(i);
            final Severity severity = mapDiagToSeverity(diagSeverity);

            prefStore.setDefault(key, severity.toString());
        }//from w ww. j av  a2 s . co  m
        final String storedSeverity = prefStore.getString(key);
        severities[i] = mapSeverityToDiag(storedSeverity);
    }
}

From source file:org.eclipse.jst.pagedesigner.editors.palette.DesignerPaletteCustomizationsHelper.java

License:Open Source License

/**
 * Load user customizations//from   w ww.j ava2 s  .com
 * @param paletteItemManager
 */
public static void loadUserCustomizations(IPaletteItemManager paletteItemManager) {
    IPreferenceStore store = getPreferenceStore();
    for (Iterator it = paletteItemManager.getAllCategories().iterator(); it.hasNext();) {
        TaglibPaletteDrawer tld = (TaglibPaletteDrawer) it.next();
        if (store.contains(PREFS_TAGLIBHIDE_PREFIX + tld.getURI())) {
            tld.setVisible(!store.getBoolean(PREFS_TAGLIBHIDE_PREFIX + tld.getURI()));
        }
    }
}

From source file:org.eclipse.linuxtools.dataviewers.annotatedsourceeditor.STContributedRulerColumn.java

License:Open Source License

/**
 * Extracts the color preference for the given preference from the given store.
 * If the given store indicates that the default value is to be used, or
 * the value stored in the preferences store is <code>null</code>,
 * the value is taken from the <code>AnnotationPreference</code>'s default
 * color value.//from   w w w  . j  av a  2 s. co m
 * <p>
 * The return value is
 * </p>
 *
 * @param store the preference store
 * @param pref the annotation preference
 * @return the RGB color preference, not <code>null</code>
 */
private static RGB getColorFromAnnotationPreference(IPreferenceStore store, AnnotationPreference pref) {
    String key = pref.getColorPreferenceKey();
    RGB rgb = null;
    if (store.contains(key)) {
        if (store.isDefault(key))
            rgb = pref.getColorPreferenceValue();
        else
            rgb = PreferenceConverter.getColor(store, key);
    }
    if (rgb == null)
        rgb = pref.getColorPreferenceValue();
    return rgb;
}

From source file:org.eclipse.linuxtools.dataviewers.annotatedsourceeditor.STContributedRulerColumn.java

License:Open Source License

private static RGB getColorFromStore(IPreferenceStore store, String key) {
    RGB rgb = null;//from   w  ww  .  jav  a 2 s  .  co m
    if (store.contains(key)) {
        if (store.isDefault(key))
            rgb = PreferenceConverter.getDefaultColor(store, key);
        else
            rgb = PreferenceConverter.getColor(store, key);
    }
    return rgb;
}

From source file:org.eclipse.mylyn.internal.java.ui.JavaUiBridgePlugin.java

License:Open Source License

public void changeProcessorCount(IPreferenceStore javaPrefs, int delta) {
    if (javaPrefs.contains(NUM_COMPUTERS_PREF_KEY)) {
        int lastNumberOfComputers = javaPrefs.getInt(NUM_COMPUTERS_PREF_KEY);
        if (lastNumberOfComputers > 0) {
            javaPrefs.putValue(NUM_COMPUTERS_PREF_KEY, Integer.toString(lastNumberOfComputers + delta));
        }/*from   w  w w.  jav  a  2 s. c  o m*/
    }
}

From source file:org.eclipse.mylyn.reviews.r4e.ui.internal.utils.UIUtils.java

License:Open Source License

/**
 * Method removeAnnotation/* w  w w  . j  a  v  a  2s.co m*/
 * 
 * @param aStore
 *            - IPreferenceStore
 * @param aPref
 *            - AnnotationPreference
 * @return RGB
 */
public static RGB getColorFromAnnotationPreference(IPreferenceStore aStore, AnnotationPreference aPref) {
    String key = aPref.getColorPreferenceKey();
    RGB rgb = null;
    if (aStore.contains(key)) {
        if (aStore.isDefault(key)) {
            rgb = aPref.getColorPreferenceValue();
        } else {
            rgb = PreferenceConverter.getColor(aStore, key);
        }
    }
    if (rgb == null) {
        rgb = aPref.getColorPreferenceValue();
    }
    return rgb;
}

From source file:org.eclipse.php.internal.ui.outline.CustomFiltersActionGroup.java

License:Open Source License

private void initializeWithViewDefaults() {
    // get default values for view
    IPreferenceStore store = PHPUiPlugin.getDefault().getPreferenceStore();

    // see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=22533
    if (!store.contains(getPreferenceKey(TAG_DUMMY_TO_TEST_EXISTENCE)))
        return;/*from  ww w  .j  ava 2  s.c  om*/

    fUserDefinedPatternsEnabled = store.getBoolean(getPreferenceKey(TAG_USER_DEFINED_PATTERNS_ENABLED));
    setUserDefinedPatterns(CustomFiltersDialog
            .convertFromString(store.getString(getPreferenceKey(TAG_USER_DEFINED_PATTERNS)), SEPARATOR));

    Iterator<Entry<String, Boolean>> iter = fEnabledFilterIds.entrySet().iterator();
    while (iter.hasNext()) {
        Entry<String, Boolean> entry = iter.next();
        String id = (String) entry.getKey();
        // set default to value from plugin contributions (fixes
        // https://bugs.eclipse.org/bugs/show_bug.cgi?id=73991 ):
        store.setDefault(id, ((Boolean) entry.getValue()).booleanValue());
        Boolean isEnabled = Boolean.valueOf(store.getBoolean(id));
        fEnabledFilterIds.put(id, isEnabled);
    }

    fLRUFilterIdsStack.clear();
    String lruFilterIds = store.getString(TAG_LRU_FILTERS);
    StringTokenizer tokenizer = new StringTokenizer(lruFilterIds, SEPARATOR);
    while (tokenizer.hasMoreTokens()) {
        String id = tokenizer.nextToken();
        if (fFilterDescriptorMap.containsKey(id) && !fLRUFilterIdsStack.contains(id))
            fLRUFilterIdsStack.push(id);
    }
}