Example usage for org.eclipse.jface.preference PreferenceConverter getDefaultColor

List of usage examples for org.eclipse.jface.preference PreferenceConverter getDefaultColor

Introduction

In this page you can find the example usage for org.eclipse.jface.preference PreferenceConverter getDefaultColor.

Prototype

public static RGB getDefaultColor(IPreferenceStore store, String name) 

Source Link

Document

Returns the default value for the color-valued preference with the given name in the given preference store.

Usage

From source file:ar.com.tadp.xml.rinzo.core.preferences.ColorPreferenceEditor.java

License:Open Source License

protected void doLoadDefault() {
    for (ColorPreferenceModel colorModel : getColorModelList()) {
        colorModel.setColorValue(/*from  w  w w .j  av  a2 s. c  o  m*/
                PreferenceConverter.getDefaultColor(getPreferenceStore(), colorModel.getPreferenceKey()));
        colorModel.setBold(getPreferenceStore().getDefaultBoolean(colorModel.getPreferenceKey() + "#bold"));
    }
}

From source file:ccw.editors.clojure.ClojureSourceViewer.java

License:Open Source License

static public RGB getRGBColor(IPreferenceStore store, String key) {
    RGB rgb = null;/*  ww w  .j a  v  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:com.aptana.ide.editors.preferences.GeneralPreferencePage.java

License:Open Source License

/**
 * @see org.eclipse.jface.preference.FieldEditorPreferencePage#performDefaults()
 */// www  .  ja va2  s . c  o  m
protected void performDefaults() {
    enableOccurrences.setSelection(
            getPreferenceStore().getDefaultBoolean(IPreferenceConstants.COLORIZER_TEXT_HIGHLIGHT_ENABLED));
    occurrenceColor.setColorValue(PreferenceConverter.getDefaultColor(getPreferenceStore(),
            IPreferenceConstants.COLORIZER_TEXT_HIGHLIGHT_BACKGROUND_COLOR));
    occurrenceColor.setEnabled(enableOccurrences.getSelection());
    boolean useSpaces = getPreferenceStore().getDefaultBoolean(IPreferenceConstants.INSERT_SPACES_FOR_TABS);
    spaces.setSelection(useSpaces);
    tabs.setSelection(!useSpaces);
    pianoKeySlider.setSelection(getPreferenceStore().getDefaultInt(IPreferenceConstants.PIANO_KEY_DIFFERENCE));
    super.performDefaults();
}

From source file:com.aptana.ide.logging.LoggingPreferences.java

License:Open Source License

/**
 * Gets default cursor line color./*  w  w  w .j a  v  a2  s.c om*/
 * @return cursor line color.
 */
public RGB getDefaultCursorLineColor() {
    return PreferenceConverter.getDefaultColor(getPreferenceStore(), CURSORLINE_COLOR_KEY);
}

From source file:com.aptana.ide.logging.LoggingPreferences.java

License:Open Source License

/**
 * Gets default text color.
 * @return text color.
 */
public RGB getDefaultTextColor() {
    return PreferenceConverter.getDefaultColor(getPreferenceStore(), TEXT_COLOR_KEY);
}

From source file:com.cisco.yangide.editor.editors.SemanticHighlightings.java

License:Open Source License

/**
 * Sets the default value and fires a property change event if necessary.
 *//*from w  ww.j a  va 2  s  .c  om*/
private static void setDefaultAndFireEvent(IPreferenceStore store, String key, RGB newValue) {
    RGB oldValue = null;
    if (store.isDefault(key)) {
        oldValue = PreferenceConverter.getDefaultColor(store, key);
    }

    PreferenceConverter.setDefault(store, key, newValue);

    if (oldValue != null && !oldValue.equals(newValue)) {
        store.firePropertyChangeEvent(key, oldValue, newValue);
    }
}

From source file:com.dubture.twig.ui.editor.SemanticHighlightingManager.java

License:Open Source License

/**
 * Sets the default value and fires a property change event if necessary.
 * /*from  www .  j a  v  a  2 s .c o m*/
 * @param store
 *            the preference store
 * @param key
 *            the preference key
 * @param newValue
 *            the new value
 */
private static void setDefaultAndFireEvent(IPreferenceStore store, String key, RGB newValue) {
    RGB oldValue = null;
    if (store.isDefault(key))
        oldValue = PreferenceConverter.getDefaultColor(store, key);

    PreferenceConverter.setDefault(store, key, newValue);
    store.setDefault(key, ColorHelper.toRGBString(newValue));

    if (oldValue != null && !oldValue.equals(newValue))
        store.firePropertyChangeEvent(key, oldValue, newValue);
}

From source file:com.google.dart.tools.ui.internal.text.editor.DartSourceViewer.java

License:Open Source License

/**
 * Creates a color from the information stored in the given preference store. Returns
 * <code>null</code> if there is no such information available.
 * /*from w  w w .  j  ava2  s.  c  o m*/
 * @param store the store to read from
 * @param key the key used for the lookup in the preference store
 * @param display the display used create the color
 * @return the created color according to the specification in the preference store
 */
private Color createColor(IPreferenceStore store, String key, Display display) {

    RGB rgb = null;

    if (store.contains(key)) {

        if (store.isDefault(key)) {
            rgb = PreferenceConverter.getDefaultColor(store, key);
        } else {
            rgb = PreferenceConverter.getColor(store, key);
        }

        if (rgb != null) {
            return new Color(display, rgb);
        }
    }

    return null;
}

From source file:com.google.dart.tools.ui.PreferenceConstants.java

License:Open Source License

/**
 * Sets the default value and fires a property change event if necessary.
 * /* ww  w .  j  av  a  2  s.  c om*/
 * @param store the preference store
 * @param key the preference key
 * @param newValue the new value
 */
private static void setDefaultAndFireEvent(IPreferenceStore store, String key, RGB newValue) {
    try {
        RGB oldValue = null;
        if (store.isDefault(key)) {
            oldValue = PreferenceConverter.getDefaultColor(store, key);
        }

        PreferenceConverter.setDefault(store, key, newValue);

        if (oldValue != null && !oldValue.equals(newValue)) {
            store.firePropertyChangeEvent(key, oldValue, newValue);
        }
    } catch (Throwable exception) {
        DartToolsPlugin.log("INFO: Could not get the default value for the color preference named " + key,
                exception);
    }
}

From source file:com.imperial.fiksen.codesimilarity.compare.ParseTreeMergeViewer.java

License:Open Source License

/**
 * Creates a color from the information stored in the given preference
 * store. Returns <code>null</code> if there is no such information
 * available.//from   www .  j  a v a 2  s . c o m
 * 
 * @param store
 *            preference store
 * @param key
 *            preference key
 * @return the color or <code>null</code>
 */
private static RGB createColor(IPreferenceStore store, String key) {
    if (!store.contains(key))
        return null;
    if (store.isDefault(key))
        return PreferenceConverter.getDefaultColor(store, key);
    return PreferenceConverter.getColor(store, key);
}