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:org.ebayopensource.vjet.eclipse.internal.ui.editor.semantic.highlighting.VjoSemanticHighlightingManager.java

License:Open Source License

/**
 * Tests whether <code>event</code> affects the enablement of semantic
 * highlighting./*w  ww  .  j  a v  a  2 s  .  c  o  m*/
 * 
 * @param event
 *            the property change under examination
 * @return <code>true</code> if <code>event</code> changed semantic
 *         highlighting enablement, <code>false</code> if it did not
 */
//   private boolean affectsEnablement(PropertyChangeEvent event) {
//      if (fSemanticHighlightings == null) {
//         return false;
//      }
//      String relevantKey = null;
//      for (int i = 0; i < fSemanticHighlightings.length; i++) {
//         if (event.getProperty().equals(fSemanticHighlightings[i].getEnabledPreferenceKey())) {
//            relevantKey = event.getProperty();
//            break;
//         }
//      }
//      if (relevantKey == null)
//         return false;
//
//      for (int i = 0; i < fSemanticHighlightings.length; i++) {
//         String key = fSemanticHighlightings[i].getEnabledPreferenceKey();
//         if (key.equals(relevantKey))
//            continue;
//         if (fPreferenceStore.getBoolean(key))
//            return false; // another is still enabled or was enabled
//                        // before
//      }
//      // all others are disabled, so toggling relevantKey affects the
//      // enablement
//      return true;
//   }

//   private void adaptToTextBackgroundChange(HighlightingStyle highlighting, PropertyChangeEvent event) {
//      RGB rgb = null;
//
//      Object value = event.getNewValue();
//      if (value instanceof RGB)
//         rgb = (RGB) value;
//      else if (value instanceof String)
//         rgb = StringConverter.asRGB((String) value);
//
//      if (rgb != null) {
//
//         String property = event.getProperty();
//         Color color = fColorManager.getColor(property);
//
//         if ((color == null || !rgb.equals(color.getRGB())) && fColorManager instanceof IColorManagerExtension) {
//            IColorManagerExtension ext = (IColorManagerExtension) fColorManager;
//            ext.unbindColor(property);
//            ext.bindColor(property, rgb);
//            color = fColorManager.getColor(property);
//         }
//
//         TextAttribute oldAttr = highlighting.getTextAttribute();
//         highlighting.setTextAttribute(new TextAttribute(oldAttr.getForeground(), color, oldAttr.getStyle()));
//      }
//   }

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:org.ebayopensource.vjet.eclipse.internal.ui.preferences.VJOBuildPathConfigurationBlock.java

License:Open Source License

public Control createControl(Composite parent) {
    initializeDialogUnits(parent);/*  ww w .  ja  v a  2s .c o m*/

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

    Group sourceFolderGroup = new Group(composite, SWT.NONE);
    sourceFolderGroup.setLayout(new GridLayout(2, false));
    sourceFolderGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    sourceFolderGroup.setText(VjetPreferenceMessages.NewVJOProjectPreferencePage_sourcefolder_label);

    this.fProjectAsSourceFolder = addRadioButton(sourceFolderGroup,
            VjetPreferenceMessages.NewVJOProjectPreferencePage_sourcefolder_project, SRCBIN_FOLDERS_IN_NEWPROJ,
            IPreferenceStore.FALSE, 0);
    this.fProjectAsSourceFolder.addSelectionListener(this.fSelectionListener);

    this.fFoldersAsSourceFolder = addRadioButton(sourceFolderGroup,
            VjetPreferenceMessages.NewVJOProjectPreferencePage_sourcefolder_folder, SRCBIN_FOLDERS_IN_NEWPROJ,
            IPreferenceStore.TRUE, 0);
    this.fFoldersAsSourceFolder.addSelectionListener(this.fSelectionListener);
    this.fSrcFolderNameLabel = new Label(sourceFolderGroup, SWT.NONE);
    GridData gridData = new GridData();
    gridData.horizontalSpan = 1;
    gridData.horizontalIndent = 10;
    this.fSrcFolderNameLabel.setLayoutData(gridData);
    this.fSrcFolderNameLabel.setText(VjetPreferenceMessages.NewVJOProjectPreferencePage_folders_src);
    this.fSrcFolderNameText = addTextControl(sourceFolderGroup, this.fSrcFolderNameLabel, SRCBIN_SRCNAME, 10);
    this.fSrcFolderNameText.addModifyListener(this.fModifyListener);

    return composite;
}

From source file:org.ebayopensource.vjet.eclipse.internal.ui.preferences.VJOBuildPathConfigurationBlock.java

License:Open Source License

public void performOk() {
    if (this.fFoldersAsSourceFolder.getSelection()) {
        this.getPreferenceStore().setValue(VjetPreferenceConstants.SRCBIN_FOLDERS_IN_NEWPROJ,
                IPreferenceStore.TRUE);
        this.getPreferenceStore().setValue(VjetPreferenceConstants.SRC_SRCNAME,
                this.fSrcFolderNameText.getText().trim());
    } else {//w  w w.j  a v a 2  s.  co  m
        this.getPreferenceStore().setValue(VjetPreferenceConstants.SRCBIN_FOLDERS_IN_NEWPROJ,
                IPreferenceStore.FALSE);
        this.getPreferenceStore().setValue(VjetPreferenceConstants.SRC_SRCNAME, "");
    }
}

From source file:org.eclipse.ant.internal.ui.AntSourceViewerConfiguration.java

License:Open Source License

private TextAttribute adaptToStyleChange(PropertyChangeEvent event, int styleAttribute,
        TextAttribute textAttribute) {
    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  .ja v  a 2  s .  com
    }

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

From source file:org.eclipse.ant.internal.ui.editor.text.AbstractAntEditorScanner.java

License:Open Source License

protected void adaptToStyleChange(PropertyChangeEvent event, Token token, int styleAttribute) {
    if (token == null) {
        return;/*from w w  w . ja v  a 2  s .c  om*/
    }
    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:org.eclipse.cdt.internal.ui.editor.SemanticHighlightingManager.java

License:Open Source License

protected 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 www  .ja v  a  2s.  co  m*/
    else
        eventValue = false;
    highlighting.setEnabled(eventValue);
}

From source file:org.eclipse.cdt.internal.ui.editor.SemanticHighlightingManager.java

License:Open Source License

protected 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;/*  w  w w  .j a  v a2s .  co 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:org.eclipse.cdt.internal.ui.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);//from ww  w . j  a  v a 2s. 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_string_literals_label;
    slave = addCheckBox(user, label, PREF_SPELLING_IGNORE_STRING_LITERALS, 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, ICHelpContextIds.SPELLING_CONFIGURATION_BLOCK);
    return composite;
}

From source file:org.eclipse.cdt.internal.ui.text.TokenStore.java

License:Open Source License

protected 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  . jav  a2 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:org.eclipse.dltk.mod.ui.preferences.NewScriptProjectPreferencePage.java

License:Open Source License

protected Control createContents(Composite parent) {
    initializeDialogUnits(parent);/*from www. ja  v  a  2  s .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.NewScriptProjectPreferencePage_sourcefolder_label);

    int indent = 0;

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

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

    indent = convertWidthInCharsToPixels(4);

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

    //      String[] InterpreterEnvironmentNames= getInterpreterEnvironmentNames();
    //      if (InterpreterEnvironmentNames.length > 0) {
    //         Label InterpreterEnvironmentSelectionLabel= new Label(result, SWT.NONE);
    //         InterpreterEnvironmentSelectionLabel.setText(PreferencesMessages.NewScriptProjectPreferencePage_InterpreterEnvironmentlibrary_label); 
    //         InterpreterEnvironmentSelectionLabel.setLayoutData(new GridData());
    //      
    //         int index= getPreferenceStore().getInt(CLASSPATH_InterpreterEnvironmentLIBRARY_INDEX);
    //         fInterpreterEnvironmentCombo= new Combo(result, SWT.READ_ONLY);
    //         fInterpreterEnvironmentCombo.setItems(InterpreterEnvironmentNames);
    //         fInterpreterEnvironmentCombo.select(index);
    //         fInterpreterEnvironmentCombo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
    //      }

    validateFolders();

    Dialog.applyDialogFont(result);
    return result;
}