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:com.agynamix.platform.frontend.preferences.ApplicationPreferenceStore.java

License:Open Source License

/**
 * Helper function: gets boolean for a given name.
 * //from w w  w .  j av  a 2 s.c  o  m
 * @param p
 * @param name
 * @return boolean
 */
private boolean getBoolean(Properties p, String name) {
    String value = p != null ? p.getProperty(name) : null;
    if (value == null)
        return BOOLEAN_DEFAULT_DEFAULT;
    if (value.equals(IPreferenceStore.TRUE))
        return true;
    return false;
}

From source file:com.agynamix.platform.frontend.preferences.ApplicationPreferenceStore.java

License:Open Source License

/**
 * Helper method: sets the value for a given name.
 * //from   w ww . j  a  v  a2  s .c  o m
 * @param p
 * @param name
 * @param value
 */
private void setValue(Properties p, String name, boolean value) {
    Assert.isTrue(p != null);
    p.put(name, value == true ? IPreferenceStore.TRUE : IPreferenceStore.FALSE);
}

From source file:com.aptana.internal.ui.text.spelling.SpellingConfigurationBlock.java

License:Open Source License

protected Control createContents(final Composite parent) {

    final Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout());

    final List allControls = new ArrayList();
    final PixelConverter converter = new PixelConverter(parent);

    final String[] trueFalse = new String[] { IPreferenceStore.TRUE, IPreferenceStore.FALSE };

    final Group user = new Group(composite, SWT.NONE);
    user.setText(PreferencesMessages.SpellingPreferencePage_group_user);
    user.setLayout(new GridLayout());
    user.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    allControls.add(user);//from w  ww.j a va 2 s.c o  m

    String label = PreferencesMessages.SpellingPreferencePage_ignore_digits_label;
    Control slave = this.addCheckBox(user, label, PREF_SPELLING_IGNORE_DIGITS, trueFalse, 0);
    allControls.add(slave);

    label = PreferencesMessages.SpellingPreferencePage_ignore_mixed_label;
    slave = this.addCheckBox(user, label, PREF_SPELLING_IGNORE_MIXED, trueFalse, 0);
    allControls.add(slave);

    label = PreferencesMessages.SpellingPreferencePage_ignore_sentence_label;
    slave = this.addCheckBox(user, label, PREF_SPELLING_IGNORE_SENTENCE, trueFalse, 0);
    allControls.add(slave);

    label = PreferencesMessages.SpellingPreferencePage_ignore_upper_label;
    slave = this.addCheckBox(user, label, PREF_SPELLING_IGNORE_UPPER, trueFalse, 0);
    allControls.add(slave);

    label = PreferencesMessages.SpellingPreferencePage_ignore_url_label;
    slave = this.addCheckBox(user, label, PREF_SPELLING_IGNORE_URLS, trueFalse, 0);
    allControls.add(slave);

    label = PreferencesMessages.SpellingPreferencePage_ignore_non_letters_label;
    slave = this.addCheckBox(user, label, PREF_SPELLING_IGNORE_NON_LETTERS, trueFalse, 0);
    allControls.add(slave);

    label = PreferencesMessages.SpellingPreferencePage_ignore_single_letters_label;
    slave = this.addCheckBox(user, label, PREF_SPELLING_IGNORE_SINGLE_LETTERS, trueFalse, 0);
    allControls.add(slave);

    // label=
    // PreferencesMessages.SpellingPreferencePage_ignore_java_strings_label;
    // slave= addCheckBox(user, label, PREF_SPELLING_IGNORE_JAVA_STRINGS,
    // trueFalse, 0);
    // allControls.add(slave);
    //      
    // label= PreferencesMessages.
    // SpellingPreferencePage_ignore_ampersand_in_properties_label;
    // slave= addCheckBox(user, label,
    // PREF_SPELLING_IGNORE_AMPERSAND_IN_PROPERTIES, trueFalse, 0);
    // allControls.add(slave);

    final Set locales = SpellCheckEngine.getLocalesWithInstalledDictionaries();
    final boolean hasPlaformDictionaries = locales.size() > 0;

    final Group engine = new Group(composite, SWT.NONE);
    if (hasPlaformDictionaries) {
        engine.setText(PreferencesMessages.SpellingPreferencePage_group_dictionaries);
    } else {
        engine.setText(PreferencesMessages.SpellingPreferencePage_group_dictionary);
    }
    engine.setLayout(new GridLayout(4, false));
    engine.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    allControls.add(engine);

    if (hasPlaformDictionaries) {
        label = PreferencesMessages.SpellingPreferencePage_dictionary_label;
        final Combo combo = this.addComboBox(engine, label, PREF_SPELLING_LOCALE, getDictionaryCodes(locales),
                getDictionaryLabels(locales), 0);
        combo.setEnabled(locales.size() > 0);
        allControls.add(combo);
        allControls.add(this.fLabels.get(combo));

        new Label(engine, SWT.NONE); // placeholder
    }

    label = PreferencesMessages.SpellingPreferencePage_workspace_dictionary_label;
    this.fDictionaryPath = this.addTextField(engine, label, PREF_SPELLING_USER_DICTIONARY, 0, 0);
    GridData gd = (GridData) this.fDictionaryPath.getLayoutData();
    gd.grabExcessHorizontalSpace = true;
    gd.widthHint = converter.convertWidthInCharsToPixels(40);
    allControls.add(this.fDictionaryPath);
    allControls.add(this.fLabels.get(this.fDictionaryPath));

    final Composite buttons = new Composite(engine, SWT.NONE);
    buttons.setLayout(new GridLayout(2, true));
    buttons.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));

    Button button = new Button(buttons, SWT.PUSH);
    button.setText(PreferencesMessages.SpellingPreferencePage_browse_label);
    button.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            SpellingConfigurationBlock.this.handleBrowseButtonSelected();
        }
    });
    SWTUtil.setButtonDimensionHint(button);
    button.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
    allControls.add(button);

    // Description for user dictionary
    new Label(engine, SWT.NONE); // filler
    final Label description = new Label(engine, SWT.NONE);
    gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gd.horizontalSpan = 3;
    description.setLayoutData(gd);
    description.setText(PreferencesMessages.SpellingPreferencePage_user_dictionary_description);
    allControls.add(description);

    this.createEncodingFieldEditor(engine, allControls);

    final Group advanced = new Group(composite, SWT.NONE);
    advanced.setText(PreferencesMessages.SpellingPreferencePage_group_advanced);
    advanced.setLayout(new GridLayout(3, false));
    advanced.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    allControls.add(advanced);

    label = PreferencesMessages.SpellingPreferencePage_problems_threshold;
    int digits = 4;
    Text text = this.addTextField(advanced, label, PREF_SPELLING_PROBLEMS_THRESHOLD, 0,
            converter.convertWidthInCharsToPixels(digits + 1));
    text.setTextLimit(digits);
    allControls.add(text);
    allControls.add(this.fLabels.get(text));

    label = PreferencesMessages.SpellingPreferencePage_proposals_threshold;
    digits = 3;
    text = this.addTextField(advanced, label, PREF_SPELLING_PROPOSAL_THRESHOLD, 0,
            converter.convertWidthInCharsToPixels(digits + 1));
    text.setTextLimit(digits);
    gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
    allControls.add(text);
    allControls.add(this.fLabels.get(text));

    if (SUPPORT_CONTENT_ASSIST_PROPOSALS) {
        label = PreferencesMessages.SpellingPreferencePage_enable_contentassist_label;
        button = this.addCheckBox(advanced, label, PREF_SPELLING_ENABLE_CONTENTASSIST, trueFalse, 0);
        allControls.add(button);
    }

    this.fAllControls = (Control[]) allControls.toArray(new Control[allControls.size()]);

    // PlatformUI.getWorkbench().getHelpSystem().setHelp(composite,
    // IJavaHelpContextIds.SPELLING_CONFIGURATION_BLOCK);
    return composite;
}

From source file:com.axmor.eclipse.typescript.editor.parser.TypeScriptSyntaxScanner.java

License:Open Source License

private void adaptToStyleChange(PropertyChangeEvent event, Token token, int styleAttribute) {
    if (token == null) {
        return;/*w  w w.j a va  2s . co m*/
    }
    boolean eventValue = false;
    Object value = event.getNewValue();
    if (value instanceof Boolean) {
        eventValue = ((Boolean) value).booleanValue();
    } else if (IPreferenceStore.TRUE.equals(value)) {
        eventValue = true;
    }

    TextAttribute attr = (TextAttribute) token.getData();
    boolean activeValue = (attr.getStyle() & styleAttribute) == styleAttribute;
    if (activeValue != eventValue) {
        token.setData(new TextAttribute(attr.getForeground(), attr.getBackground(),
                eventValue ? attr.getStyle() | styleAttribute : attr.getStyle() & ~styleAttribute));
    }
}

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

License:Open Source License

private void adaptToStyleChange(Token token, 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;//w  w w  . j  ava  2 s .co  m

    Object data = token.getData();
    if (data instanceof TextAttribute) {
        TextAttribute oldAttr = (TextAttribute) data;
        boolean activeValue = (oldAttr.getStyle() & styleAttribute) == styleAttribute;
        if (activeValue != eventValue)
            token.setData(new TextAttribute(oldAttr.getForeground(), oldAttr.getBackground(),
                    eventValue ? oldAttr.getStyle() | styleAttribute : oldAttr.getStyle() & ~styleAttribute));
    }
}

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

License:Open Source License

private void adaptToEnablementChange(Highlighting 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;/*from www .  j  a  v a 2 s.  c  o m*/
    } else {
        eventValue = false;
    }
    highlighting.setEnabled(eventValue);
}

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

License:Open Source License

private void adaptToTextStyleChange(Highlighting 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;/* w ww. jav a  2 s  .c o m*/
    }

    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));
    }
}

From source file:com.dubture.twig.ui.preferences.TwigSyntaxColoringPage.java

License:Open Source License

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;/*from   w w w.  j  av a  2  s  . c o m*/
    else
        eventValue = false;
    highlighting.setEnabled(eventValue);
}

From source file:com.dubture.twig.ui.preferences.TwigSyntaxColoringPage.java

License:Open Source License

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;//from ww w.j  a  v  a 2  s. c  o m

    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));
}

From source file:com.google.dart.tools.ui.internal.text.functions.AbstractDartScanner.java

License:Open Source License

private void adaptToStyleChange(Token token, 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;/*from w  w  w  .  j a  v a2  s  . c  om*/
    }

    Object data = token.getData();
    if (data instanceof TextAttribute) {
        TextAttribute oldAttr = (TextAttribute) data;
        boolean activeValue = (oldAttr.getStyle() & styleAttribute) == styleAttribute;
        if (activeValue != eventValue) {
            token.setData(new TextAttribute(oldAttr.getForeground(), oldAttr.getBackground(),
                    eventValue ? oldAttr.getStyle() | styleAttribute : oldAttr.getStyle() & ~styleAttribute));
        }
    }
}