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

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

Introduction

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

Prototype

String TRUE

To view the source code for org.eclipse.jface.preference IPreferenceStore TRUE.

Click Source Link

Document

The string representation used for true ("true").

Usage

From source file:ptolemy.backtrack.eclipse.plugin.editor.SemanticHighlightingReconciler.java

License:Open Source License

/** Adapt to a change on the enabled state.
 *
 *  @param highlighting The highlighting style.
 *  @param event The event of the change.
 *//*from   w  w w .  j  av a  2  s .c  om*/
private void _adaptToEnablementChange(HighlightingStyle highlighting, PropertyChangeEvent event) {
    Object value = event.getNewValue();
    boolean eventValue;

    if (value instanceof Boolean) {
        eventValue = ((Boolean) value).booleanValue();
    } else if (IPreferenceStore.TRUE.equals(value)) {
        eventValue = true;
    } else {
        eventValue = false;
    }

    highlighting.setEnabled(eventValue);
}

From source file:ptolemy.backtrack.eclipse.plugin.editor.SemanticHighlightingReconciler.java

License:Open Source License

/** Adapt to a change on text style.
 *
 *  @param highlighting The highlighting style.
 *  @param event The event of the change.
 *///  www.j  a  va2 s  .  co m
private void _adaptToTextStyleChange(HighlightingStyle highlighting, PropertyChangeEvent event,
        int styleAttribute) {
    boolean eventValue = false;
    Object value = event.getNewValue();

    if (value instanceof Boolean) {
        eventValue = ((Boolean) value).booleanValue();
    } else if (IPreferenceStore.TRUE.equals(value)) {
        eventValue = true;
    }

    TextAttribute oldAttr = highlighting.getTextAttribute();
    boolean activeValue = (oldAttr.getStyle() & styleAttribute) == styleAttribute;

    if (activeValue != eventValue) {
        highlighting.setTextAttribute(new TextAttribute(oldAttr.getForeground(), oldAttr.getBackground(),
                eventValue ? (oldAttr.getStyle() | styleAttribute) : (oldAttr.getStyle() & ~styleAttribute)));
    }
}