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.locationtech.udig.catalog.RemotePreferenceStore.java

License:Open Source License

/**
 * Had to add this method as the Property object was being unreliable in returning its contents
 * using the getProperty method. We also want null to be null, rather than not "null".
 *///ww w .jav a2s.  c om
private String toString(Object object) {
    if (object == null)
        return null;
    if (object instanceof Boolean) {
        if (((Boolean) object).booleanValue()) {
            return IPreferenceStore.TRUE;
        } else {
            return IPreferenceStore.FALSE;
        }
    }
    return String.valueOf(object);
}

From source file:org.locationtech.udig.catalog.RemotePreferenceStore.java

License:Open Source License

private boolean getBoolean(Map<String, String> p, String name) {
    String value = p != null ? p.get(name) : null;
    if (value == null)
        return BOOLEAN_DEFAULT_DEFAULT;
    if (value.equals(IPreferenceStore.TRUE))
        return true;
    return false;
}

From source file:org.mailster.gui.prefs.store.MailsterPrefStore.java

License:Open Source License

/**
 * Helper function: gets boolean for a given name.
 * //w w  w .  j a  v a 2 s  . com
 * @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:org.mailster.gui.prefs.store.MailsterPrefStore.java

License:Open Source License

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

From source file:org.rubypeople.rdt.internal.ui.preferences.NewRubyProjectPreferencePage.java

License:Open Source License

protected Control createContents(Composite parent) {
    initializeDialogUnits(parent);// w  w  w  . ja  v  a 2s  .  c  o 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.NewRubyProjectPreferencePage_sourcefolder_label);

    int indent = 0;

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

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

    indent = convertWidthInCharsToPixels(4);

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

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

        int index = getPreferenceStore().getInt(LOADPATH_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:org.rubypeople.rdt.internal.ui.preferences.SpellingConfigurationBlock.java

License:Open Source License

protected Control createContents(final Composite parent) {

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

    List allControls = new ArrayList();
    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_preferences_user);
    user.setLayout(new GridLayout());
    user.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    allControls.add(user);//from   w  w  w .ja v  a 2  s  .  co  m

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

    final Group engine = new Group(composite, SWT.NONE);
    engine.setText(PreferencesMessages.SpellingPreferencePage_preferences_engine);
    engine.setLayout(new GridLayout(4, false));
    engine.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    allControls.add(engine);

    label = PreferencesMessages.SpellingPreferencePage_dictionary_label;
    final Set locales = SpellCheckEngine.getAvailableLocales();

    Combo combo = addComboBox(engine, label, PREF_SPELLING_LOCALE, getDictionaryCodes(locales),
            getDictionaryLabels(locales), 0);
    combo.setEnabled(locales.size() > 1);
    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));

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

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

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

    label = PreferencesMessages.SpellingPreferencePage_proposals_threshold;
    Text text = addTextField(advanced, label, PREF_SPELLING_PROPOSAL_THRESHOLD, 0, 0);
    text.setTextLimit(3);
    gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
    gd.widthHint = converter.convertWidthInCharsToPixels(4);
    text.setLayoutData(gd);
    allControls.add(text);
    allControls.add(fLabels.get(text));

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

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

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

From source file:org.summer.dsl.builder.preferences.BuilderConfigurationBlock.java

License:Open Source License

private Composite createBuildPathTabContent(Composite parent) {
    String[] trueFalseValues = new String[] { IPreferenceStore.TRUE, IPreferenceStore.FALSE };
    int columns = 3;
    final ScrolledPageContent pageContent = new ScrolledPageContent(parent);
    GridLayout layout = new GridLayout();
    layout.numColumns = columns;/* w w  w .j a v  a 2 s  .c  om*/
    layout.marginHeight = 0;
    layout.marginWidth = 0;

    Composite composite = pageContent.getBody();
    composite.setLayout(layout);
    String label = Messages.BuilderConfigurationBlock_GeneralSection_Label;
    ExpandableComposite excomposite = createStyleSection(composite, label, columns);

    Composite othersComposite = new Composite(excomposite, SWT.NONE);
    excomposite.setClient(othersComposite);
    othersComposite.setLayout(new GridLayout(columns, false));

    addCheckBox(othersComposite, Messages.BuilderPreferencePage_GenerateAuto,
            BuilderPreferenceAccess.PREF_AUTO_BUILDING, trueFalseValues, 0);

    Set<OutputConfiguration> outputConfigurations = configurationProvider.getOutputConfigurations(getProject());

    for (OutputConfiguration outputConfiguration : outputConfigurations) {
        label = outputConfiguration.getDescription();
        excomposite = createStyleSection(composite, label, columns);
        othersComposite = new Composite(excomposite, SWT.NONE);
        excomposite.setClient(othersComposite);
        othersComposite.setLayout(new GridLayout(columns, false));
        addTextField(othersComposite, Messages.OutputConfigurationPage_Directory, BuilderPreferenceAccess
                .getKey(outputConfiguration, EclipseOutputConfigurationProvider.OUTPUT_DIRECTORY), 0, 200);
        addCheckBox(othersComposite, Messages.OutputConfigurationPage_CreateDirectory, BuilderPreferenceAccess
                .getKey(outputConfiguration, EclipseOutputConfigurationProvider.OUTPUT_CREATE_DIRECTORY),
                trueFalseValues, 0);
        addCheckBox(othersComposite, Messages.OutputConfigurationPage_OverrideExistingResources,
                BuilderPreferenceAccess.getKey(outputConfiguration,
                        EclipseOutputConfigurationProvider.OUTPUT_OVERRIDE),
                trueFalseValues, 0);
        addCheckBox(othersComposite, Messages.OutputConfigurationPage_CreatesDerivedResources,
                BuilderPreferenceAccess.getKey(outputConfiguration,
                        EclipseOutputConfigurationProvider.OUTPUT_DERIVED),
                trueFalseValues, 0);
        addCheckBox(othersComposite, Messages.OutputConfigurationPage_CleanupDerivedResources,
                BuilderPreferenceAccess.getKey(outputConfiguration,
                        EclipseOutputConfigurationProvider.OUTPUT_CLEANUP_DERIVED),
                trueFalseValues, 0);
        addCheckBox(
                othersComposite, Messages.OutputConfigurationPage_CleanDirectory, BuilderPreferenceAccess
                        .getKey(outputConfiguration, EclipseOutputConfigurationProvider.OUTPUT_CLEAN_DIRECTORY),
                trueFalseValues, 0);
        final Button installAsPrimaryButton = addCheckBox(othersComposite,
                Messages.BuilderConfigurationBlock_InstallDslAsPrimarySource,
                BuilderPreferenceAccess.getKey(outputConfiguration,
                        EclipseOutputConfigurationProvider.INSTALL_DSL_AS_PRIMARY_SOURCE),
                trueFalseValues, 0);
        final Button hideLocalButton = addCheckBox(othersComposite,
                Messages.BuilderConfigurationBlock_hideSyntheticLocalVariables,
                BuilderPreferenceAccess.getKey(outputConfiguration,
                        EclipseOutputConfigurationProvider.HIDE_LOCAL_SYNTHETIC_VARIABLES),
                trueFalseValues, 0);
        hideLocalButton.setEnabled(installAsPrimaryButton.getSelection());
        installAsPrimaryButton.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                hideLocalButton.setEnabled(installAsPrimaryButton.getSelection());
            }
        });
        GridData hideLocalButtonData = new GridData();
        hideLocalButtonData.horizontalIndent = 32;
        hideLocalButton.setLayoutData(hideLocalButtonData);
        addCheckBox(othersComposite, Messages.OutputConfigurationPage_KeepLocalHistory, BuilderPreferenceAccess
                .getKey(outputConfiguration, EclipseOutputConfigurationProvider.OUTPUT_KEEP_LOCAL_HISTORY),
                trueFalseValues, 0);
    }
    registerKey(OptionsConfigurationBlock.IS_PROJECT_SPECIFIC);
    IDialogSettings section = Activator.getDefault().getDialogSettings().getSection(SETTINGS_SECTION_NAME);
    restoreSectionExpansionStates(section);
    return pageContent;
}

From source file:org.talend.sqlbuilder.sqleditor.AbstractSQLScanner.java

License:Open Source License

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

    final Object data = token.getData();
    if (data instanceof TextAttribute) {
        final TextAttribute oldAttr = (TextAttribute) data;
        final 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:org.textmapper.lapg.common.ui.editor.colorer.DefaultHighlightingManager.java

License:Open Source License

private void adaptToEnablementChange(Highlighting highlighting, PropertyChangeEvent event) {
    if (highlighting == null) {
        return;//from www  .j  a  va2  s  .c o  m
    }
    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.textmapper.lapg.common.ui.editor.colorer.DefaultHighlightingManager.java

License:Open Source License

private void adaptToTextStyleChange(ColorDescriptor descriptor, PropertyChangeEvent event, int styleAttribute) {
    if (descriptor.getTextAttribute() == null) {
        return;//from  w  w w  .j a  va2s. 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 oldAttr = descriptor.getTextAttribute();
    boolean activeValue = (oldAttr.getStyle() & styleAttribute) == styleAttribute;

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