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.safi.workshop.sqlexplorer.sqleditor.AbstractSQLScanner.java

License:Open Source License

private void adaptToStyleChange(Token token, PropertyChangeEvent event) {
    boolean bold = false;
    Object value = event.getNewValue();
    if (value instanceof Boolean)
        bold = ((Boolean) value).booleanValue();
    else if (value instanceof String) {
        String s = (String) value;
        if (IPreferenceStore.TRUE.equals(s))
            bold = true;// www . j a v a  2  s .co  m
        else if (IPreferenceStore.FALSE.equals(s))
            bold = false;
    }

    Object data = token.getData();
    if (data instanceof TextAttribute) {
        TextAttribute oldAttr = (TextAttribute) data;
        boolean isBold = (oldAttr.getStyle() == SWT.BOLD);
        if (isBold != bold)
            token.setData(new TextAttribute(oldAttr.getForeground(), oldAttr.getBackground(),
                    bold ? SWT.BOLD : SWT.NORMAL));
    }
}

From source file:cz.vutbr.fit.xhriba01.bc.jdt.ui.javaeditor.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  va2s .c om*/
    else
        eventValue = false;
    highlighting.setEnabled(eventValue);
}

From source file:cz.vutbr.fit.xhriba01.bc.jdt.ui.javaeditor.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;/*from   www .j  ava 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:descent.internal.ui.preferences.NewJavaProjectPreferencePage.java

License:Open Source License

protected Control createContents(Composite parent) {
    initializeDialogUnits(parent);// w  w  w.j a va  2s  .  com

    Composite result = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = 0;
    layout.verticalSpacing = convertVerticalDLUsToPixels(10);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.numColumns = 2;
    result.setLayout(layout);

    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 2;

    Group sourceFolderGroup = new Group(result, SWT.NONE);
    layout = new GridLayout();
    layout.numColumns = 2;
    sourceFolderGroup.setLayout(layout);
    sourceFolderGroup.setLayoutData(gd);
    sourceFolderGroup.setText(PreferencesMessages.NewJavaProjectPreferencePage_sourcefolder_label);

    int indent = 0;

    fProjectAsSourceFolder = addRadioButton(sourceFolderGroup,
            PreferencesMessages.NewJavaProjectPreferencePage_sourcefolder_project, SRCBIN_FOLDERS_IN_NEWPROJ,
            IPreferenceStore.FALSE, indent);
    fProjectAsSourceFolder.addSelectionListener(fSelectionListener);

    fFoldersAsSourceFolder = addRadioButton(sourceFolderGroup,
            PreferencesMessages.NewJavaProjectPreferencePage_sourcefolder_folder, SRCBIN_FOLDERS_IN_NEWPROJ,
            IPreferenceStore.TRUE, indent);
    fFoldersAsSourceFolder.addSelectionListener(fSelectionListener);

    indent = convertWidthInCharsToPixels(4);

    fSrcFolderNameLabel = new Label(sourceFolderGroup, SWT.NONE);
    fSrcFolderNameLabel.setText(PreferencesMessages.NewJavaProjectPreferencePage_folders_src);
    fSrcFolderNameText = addTextControl(sourceFolderGroup, fSrcFolderNameLabel, SRCBIN_SRCNAME, indent);
    fSrcFolderNameText.addModifyListener(fModifyListener);

    fBinFolderNameLabel = new Label(sourceFolderGroup, SWT.NONE);
    fBinFolderNameLabel.setText(PreferencesMessages.NewJavaProjectPreferencePage_folders_bin);
    fBinFolderNameText = addTextControl(sourceFolderGroup, fBinFolderNameLabel, SRCBIN_BINNAME, indent);
    fBinFolderNameText.addModifyListener(fModifyListener);

    String[] jreNames = getJRENames();
    if (jreNames.length > 0) {
        Label jreSelectionLabel = new Label(result, SWT.NONE);
        jreSelectionLabel.setText(PreferencesMessages.NewJavaProjectPreferencePage_jrelibrary_label);
        jreSelectionLabel.setLayoutData(new GridData());

        int index = getPreferenceStore().getInt(CLASSPATH_JRELIBRARY_INDEX);
        fJRECombo = new Combo(result, SWT.READ_ONLY);
        fJRECombo.setItems(jreNames);
        fJRECombo.select(index);
        fJRECombo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
    }

    validateFolders();

    Dialog.applyDialogFont(result);
    return result;
}

From source file:eclipse.spellchecker.preferences.SpellingConfigurationBlock.java

License:Open Source License

@Override
protected Control createContents(final Composite parent) {

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

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

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

    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);/*w ww .jav  a  2 s.c  om*/

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

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

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

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

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

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

    label = PreferencesMessages.SpellingPreferencePage_ignore_single_letters_label;
    slave = 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<Locale> locales = SpellCheckEngine.getLocalesWithInstalledDictionaries();
    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;
        Combo combo = addComboBox(engine, label, PREF_SPELLING_LOCALE, getDictionaryCodes(locales),
                getDictionaryLabels(locales), 0);
        combo.setEnabled(locales.size() > 0);
        allControls.add(combo);
        allControls.add(fLabels.get(combo));

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

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

    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() {

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

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

        @Override
        public void widgetSelected(SelectionEvent e) {
            handleVariablesButtonSelected();
        }

    });
    SWTUtil.setButtonDimensionHint(button);
    button.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
    allControls.add(button);

    // Description for user dictionary
    new Label(engine, SWT.NONE); // filler
    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);

    createEncodingFieldEditor(engine, allControls);

    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 = addTextField(advanced, label, PREF_SPELLING_PROBLEMS_THRESHOLD, 0,
            converter.convertWidthInCharsToPixels(digits + 1));
    text.setTextLimit(digits);
    allControls.add(text);
    allControls.add(fLabels.get(text));

    label = PreferencesMessages.SpellingPreferencePage_proposals_threshold;
    digits = 3;
    text = 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(fLabels.get(text));

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

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

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

From source file:ext.org.eclipse.jdt.internal.ui.preferences.NewJavaProjectPreferencePage.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    initializeDialogUnits(parent);//from  ww  w . ja va2  s  . co  m

    Composite result = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = 0;
    layout.verticalSpacing = convertVerticalDLUsToPixels(10);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.numColumns = 2;
    result.setLayout(layout);

    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 2;

    Group sourceFolderGroup = new Group(result, SWT.NONE);
    layout = new GridLayout();
    layout.numColumns = 2;
    sourceFolderGroup.setLayout(layout);
    sourceFolderGroup.setLayoutData(gd);
    sourceFolderGroup.setText(PreferencesMessages.NewJavaProjectPreferencePage_sourcefolder_label);

    int indent = 0;

    fProjectAsSourceFolder = addRadioButton(sourceFolderGroup,
            PreferencesMessages.NewJavaProjectPreferencePage_sourcefolder_project, SRCBIN_FOLDERS_IN_NEWPROJ,
            IPreferenceStore.FALSE, indent);
    fProjectAsSourceFolder.addSelectionListener(fSelectionListener);

    fFoldersAsSourceFolder = addRadioButton(sourceFolderGroup,
            PreferencesMessages.NewJavaProjectPreferencePage_sourcefolder_folder, SRCBIN_FOLDERS_IN_NEWPROJ,
            IPreferenceStore.TRUE, indent);
    fFoldersAsSourceFolder.addSelectionListener(fSelectionListener);

    indent = convertWidthInCharsToPixels(4);

    fSrcFolderNameLabel = new Label(sourceFolderGroup, SWT.NONE);
    fSrcFolderNameLabel.setText(PreferencesMessages.NewJavaProjectPreferencePage_folders_src);
    fSrcFolderNameText = addTextControl(sourceFolderGroup, fSrcFolderNameLabel, SRCBIN_SRCNAME, indent);
    fSrcFolderNameText.addModifyListener(fModifyListener);

    fBinFolderNameLabel = new Label(sourceFolderGroup, SWT.NONE);
    fBinFolderNameLabel.setText(PreferencesMessages.NewJavaProjectPreferencePage_folders_bin);
    fBinFolderNameText = addTextControl(sourceFolderGroup, fBinFolderNameLabel, SRCBIN_BINNAME, indent);
    fBinFolderNameText.addModifyListener(fModifyListener);

    String[] jreNames = getJRENames();
    if (jreNames.length > 0) {
        Label jreSelectionLabel = new Label(result, SWT.NONE);
        jreSelectionLabel.setText(PreferencesMessages.NewJavaProjectPreferencePage_jrelibrary_label);
        jreSelectionLabel.setLayoutData(new GridData());

        int index = getPreferenceStore().getInt(CLASSPATH_JRELIBRARY_INDEX);
        fJRECombo = new Combo(result, SWT.READ_ONLY);
        fJRECombo.setItems(jreNames);
        fJRECombo.select(index);
        fJRECombo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
    }

    validateFolders();

    Dialog.applyDialogFont(result);
    return result;
}

From source file:net.sf.eclipsefp.haskell.ui.internal.editors.haskell.text.ScannerManager.java

License:Open Source License

private void handleBoldChange(final Token token, final PropertyChangeEvent event) {
    Object o = event.getNewValue();

    boolean bold = (o instanceof Boolean) ? ((Boolean) o).booleanValue() : IPreferenceStore.TRUE.equals(o);
    Object data = token.getData();
    if (data instanceof TextAttribute) {
        TextAttribute oldAttr = (TextAttribute) data;
        boolean wasBold = ((oldAttr.getStyle() & SWT.BOLD) != 0);
        if (wasBold != bold) {
            int newStyle = bold ? oldAttr.getStyle() | SWT.BOLD : oldAttr.getStyle() ^ SWT.BOLD;
            TextAttribute newAttribute = new TextAttribute(oldAttr.getForeground(), oldAttr.getBackground(),
                    newStyle);/*ww w .  j  av  a  2  s . co  m*/
            token.setData(newAttribute);
        }
    }
}

From source file:net.sourceforge.eclipsetrader.core.db.PersistentPreferenceStore.java

License:Open Source License

/**
 * Helper function: gets boolean for a given name.
 * //from w w w . jav a2s  . c  o m
 * @param p
 * @param name
 * @return boolean
 */
private boolean getBoolean(Map p, String name) {
    String value = (String) p.get(name);
    if (value == null)
        return BOOLEAN_DEFAULT_DEFAULT;
    if (value.equals(IPreferenceStore.TRUE))
        return true;
    return false;
}

From source file:net.sourceforge.eclipsetrader.core.db.PersistentPreferenceStore.java

License:Open Source License

/**
 * Helper method: sets the value for a given name.
 * @param p/*from  w  ww. j a va2 s.  com*/
 * @param name
 * @param value
 */
private void setValue(Map p, String name, boolean value) {
    p.put(name, value == true ? IPreferenceStore.TRUE : IPreferenceStore.FALSE);
}

From source file:org.datanucleus.ide.eclipse.project.ProjectHelper.java

License:Open Source License

public static boolean getBooleanPreferenceValue(IResource resource, String pageId, String name) {
    IProject project = resource.getProject();
    String value = null;/* w w  w.  ja v  a  2s  . com*/
    if (useProjectSettings(project, pageId))
        value = getProperty(resource, pageId, name);
    if (value != null) {
        if (value.equals(IPreferenceStore.TRUE))
            return true;
        else
            return false;
    }
    value = store.getString(name);
    if (value != null) {
        if (value.equals(IPreferenceStore.TRUE))
            return true;
        else
            return false;
    }
    return false;
}