Example usage for org.eclipse.jface.preference IntegerFieldEditor IntegerFieldEditor

List of usage examples for org.eclipse.jface.preference IntegerFieldEditor IntegerFieldEditor

Introduction

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

Prototype

public IntegerFieldEditor(String name, String labelText, Composite parent, int textLimit) 

Source Link

Document

Creates an integer field editor.

Usage

From source file:ch.elexis.core.ui.preferences.ScannerPref.java

License:Open Source License

@Override
protected void createFieldEditors() {
    addField(new IntegerFieldEditor(Preferences.SCANNER_PREFIX_CODE, Messages.ScannerPref_ScannerPrefix,
            getFieldEditorParent(), 10));

    addField(new IntegerFieldEditor(Preferences.SCANNER_POSTFIX_CODE, Messages.ScannerPref_ScannerPostfix,
            getFieldEditorParent(), 10));

    addField(new IntegerFieldEditor(Preferences.BARCODE_LENGTH, Messages.ScannerPref_Barcodelength,
            getFieldEditorParent(), 50));
}

From source file:ch.elexis.preferences.ScannerPref.java

License:Open Source License

@Override
protected void createFieldEditors() {
    addField(new IntegerFieldEditor(PreferenceConstants.SCANNER_PREFIX_CODE, Messages.ScannerPref_ScannerPrefix,
            getFieldEditorParent(), 10));

    addField(new IntegerFieldEditor(PreferenceConstants.SCANNER_POSTFIX_CODE,
            Messages.ScannerPref_ScannerPostfix, getFieldEditorParent(), 10));

    addField(new IntegerFieldEditor(PreferenceConstants.BARCODE_LENGTH, Messages.ScannerPref_Barcodelength,
            getFieldEditorParent(), 50));
}

From source file:com.aptana.editor.common.preferences.CommonEditorPreferencePage.java

License:Open Source License

protected void createTextEditingOptions(Composite parent, String groupName) {
    Composite group = AptanaPreferencePage.createGroup(parent, groupName);
    group.setLayout(GridLayoutFactory.swtDefaults().numColumns(3).create());
    group.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());

    Label label = new Label(group, SWT.NONE);
    label.setText(Messages.CommonEditorPreferencePage_LBL_TabPolicy);
    label.setLayoutData(GridDataFactory.fillDefaults().create());

    tabSpaceCombo = new Combo(group, SWT.DROP_DOWN | SWT.READ_ONLY);
    tabSpaceCombo.add(Messages.CommonEditorPreferencePage_UseSpacesOption);
    tabSpaceCombo.add(Messages.CommonEditorPreferencePage_UseTabOption);
    tabSpaceCombo.add(Messages.CommonEditorPreferencePage_UseDefaultOption);
    tabSpaceCombo.setLayoutData(GridDataFactory.fillDefaults().create());

    setTabSpaceCombo();//from  w  ww.  j  av a 2 s. com

    final Composite fieldEditorGroup = new Composite(group, SWT.NONE);
    fieldEditorGroup.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());

    tabSpaceCombo.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent e) {
            Object source = e.getSource();
            if (source == tabSpaceCombo) {
                tabSize.setEnabled(
                        !tabSpaceCombo.getText().equals(Messages.CommonEditorPreferencePage_UseDefaultOption),
                        fieldEditorGroup);
            }
        }

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });

    tabSize = new IntegerFieldEditor(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH,
            Messages.CommonEditorPreferencePage_Tab_Size_Label, fieldEditorGroup, 5) {
        @Override
        protected void doLoadDefault() {
            Text text = getTextControl();
            if (text != null) {
                int value = getChainedEditorPreferenceStore().getInt(getPreferenceName());
                text.setText(Integer.toString(value));
            }
            valueChanged();
            setEnabled(!tabSpaceCombo.getText().equals(Messages.CommonEditorPreferencePage_UseDefaultOption),
                    fieldEditorGroup);
        }

        @Override
        protected void doLoad() {
            Text text = getTextControl();
            if (text != null) {
                int value = getChainedEditorPreferenceStore().getInt(getPreferenceName());
                text.setText(Integer.toString(value));
                oldValue = Integer.toString(value);
            }
        }

        @Override
        protected void doStore() {
            // This is called only when Apply or OK are clicked on the dialog, so we are OK to store to the
            // preferences here.
            Text text = getTextControl();
            if (text != null) {
                Integer i = new Integer(text.getText());
                int globalEditorValue = new ChainedPreferenceStore(
                        new IPreferenceStore[] { CommonEditorPlugin.getDefault().getPreferenceStore(),
                                EditorsPlugin.getDefault().getPreferenceStore() }).getInt(
                                        AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH);

                if (i.intValue() == globalEditorValue || tabSpaceCombo.getText()
                        .equals(Messages.CommonEditorPreferencePage_UseDefaultOption)) {
                    // Remove preference from plugin preference store if it has the same value as the global editor
                    // value, or if the tab-policy is set to use the global settings.
                    removePluginDefaults();
                    getPluginPreferenceStore()
                            .remove(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH);
                } else {
                    getPreferenceStore().setValue(getPreferenceName(), i.intValue());
                }
            }

        }

    };
    tabSize.setEmptyStringAllowed(false);
    tabSize.setValidRange(1, 20);
    tabSize.setEnabled(!tabSpaceCombo.getText().equals(Messages.CommonEditorPreferencePage_UseDefaultOption),
            fieldEditorGroup);
    addField(tabSize);

    createAutoIndentOptions(group);

    tabSizeListener = new IPropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent event) {
            if (AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH.equals(event.getProperty())) {
                // Update the tab-size control
                setTabSpaceCombo();
                tabSize.load();
            }
        }
    };
    // Listen to any external changes to the tab-size. The code-formatter preference page may change this value, so
    // we need to track it here, as long as this page is not disposed.
    getPreferenceStore().addPropertyChangeListener(tabSizeListener);
}

From source file:com.aptana.ide.editors.preferences.GeneralPreferencePage.java

License:Open Source License

/**
 * Creates the field editors. Field editors are abstractions of the common GUI blocks needed to manipulate various
 * types of preferences. Each field editor knows how to save and restore itself.
 *///from w  w  w  . java2  s. c  o  m
public void createFieldEditors() {
    addTab(Messages.GeneralPreferencePage_General);

    Composite appearanceComposite = getFieldEditorParent();
    Composite group = com.aptana.ide.core.ui.preferences.GeneralPreferencePage.createGroup(appearanceComposite,
            Messages.GeneralPreferencePage_Formatting);

    Composite occurrenceComp = new Composite(group, SWT.NONE);
    GridLayout occLayout = new GridLayout(2, false);
    occLayout.marginWidth = 0;
    occLayout.marginHeight = 0;
    occurrenceComp.setLayout(occLayout);
    occurrenceComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    enableOccurrences = new Button(occurrenceComp, SWT.CHECK);

    enableOccurrences.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            occurrenceColor.setEnabled(enableOccurrences.getSelection());
        }

    });
    enableOccurrences.setSelection(
            getPreferenceStore().getBoolean(IPreferenceConstants.COLORIZER_TEXT_HIGHLIGHT_ENABLED));
    enableOccurrences.setText(Messages.GeneralPreferencePage_MarkOccurrences);
    occurrenceColor = new ColorSelector(occurrenceComp);
    occurrenceColor.setEnabled(enableOccurrences.getSelection());
    occurrenceColor.setColorValue(PreferenceConverter.getColor(getPreferenceStore(),
            IPreferenceConstants.COLORIZER_TEXT_HIGHLIGHT_BACKGROUND_COLOR));

    // addField(new BooleanFieldEditor(IPreferenceConstants.ENABLE_WORD_WRAP,
    // Messages.GeneralPreferencePage_EnableWordWrap, group));

    addField(new BooleanFieldEditor(IPreferenceConstants.INSERT_ON_TAB,
            Messages.GeneralPreferencePage_InsertSelectedProposal, group));

    addField(new RadioGroupFieldEditor(AbstractTextEditor.PREFERENCE_NAVIGATION_SMART_HOME_END,
            Messages.GeneralPreferencePage_HomeEndBehavior, 1,
            new String[][] { { Messages.GeneralPreferencePage_ToggleBetween, "true" }, //$NON-NLS-1$
                    { Messages.GeneralPreferencePage_JumpsStartEnd, "false" } }, //$NON-NLS-1$
            appearanceComposite, true));

    group = com.aptana.ide.core.ui.preferences.GeneralPreferencePage.createGroup(appearanceComposite,
            Messages.GeneralPreferencePage_LBL_Colorization);
    Composite pianoKeyComp = new Composite(group, SWT.NONE);
    GridLayout pkcLayout = new GridLayout(3, false);
    pkcLayout.marginWidth = 0;
    pkcLayout.marginHeight = 0;
    pianoKeyComp.setLayout(pkcLayout);
    pianoKeyComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    Label pianoKeyLabel = new Label(pianoKeyComp, SWT.LEFT);
    pianoKeyLabel.setText(Messages.GeneralPreferencePage_LBL_PianoKeyColorDifference);
    GridData pklData = new GridData(SWT.FILL, SWT.FILL, true, false);
    pklData.horizontalSpan = 3;
    pianoKeyLabel.setLayoutData(pklData);
    Label less = new Label(pianoKeyComp, SWT.LEFT);
    less.setText(Messages.GeneralPreferencePage_LBL_Less);
    pianoKeySlider = new Scale(pianoKeyComp, SWT.HORIZONTAL);
    pianoKeySlider.setIncrement(5);
    pianoKeySlider.setMinimum(1);
    pianoKeySlider.setMaximum(50);
    pianoKeySlider.setSelection(getPreferenceStore().getInt(IPreferenceConstants.PIANO_KEY_DIFFERENCE));
    Label more = new Label(pianoKeyComp, SWT.LEFT);
    more.setText(Messages.GeneralPreferencePage_LBL_More);

    Composite wsGroup = com.aptana.ide.core.ui.preferences.GeneralPreferencePage
            .createGroup(appearanceComposite, Messages.GeneralPreferencePage_TabInsertion);
    Composite wsComp = new Composite(wsGroup, SWT.NONE);

    GridLayout wsLayout = new GridLayout(3, false);
    wsLayout.marginWidth = 0;
    wsLayout.marginHeight = 0;
    wsComp.setLayout(wsLayout);
    wsComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    tabs = new Button(wsComp, SWT.RADIO);
    Composite spaceComp = new Composite(wsComp, SWT.NONE);
    wsLayout = new GridLayout(2, false);
    wsLayout.marginWidth = 0;
    wsLayout.marginHeight = 0;
    wsLayout.horizontalSpacing = 0;
    spaceComp.setLayout(wsLayout);
    spaceComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    spaces = new Button(spaceComp, SWT.RADIO);
    final Link currentTabSize = new Link(spaceComp, SWT.NONE);
    IPreferenceStore store = EditorsPlugin.getDefault().getPreferenceStore();
    int size = store.getInt(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH);
    spaces.setText(StringUtils.format(Messages.GeneralPreferencePage_UseSpaces, size));
    tabs.setText(Messages.GeneralPreferencePage_UseTabs);
    store.addPropertyChangeListener(tabWidthListener);
    currentTabSize.setText(Messages.GeneralPreferencePage_EditLink);
    currentTabSize.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            ((IWorkbenchPreferenceContainer) getContainer())
                    .openPage("org.eclipse.ui.preferencePages.GeneralTextEditor", null); //$NON-NLS-1$
        }

    });
    boolean useSpaces = getPreferenceStore().getBoolean(IPreferenceConstants.INSERT_SPACES_FOR_TABS);
    spaces.setSelection(useSpaces);
    tabs.setSelection(!useSpaces);
    tabs.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            spaces.setSelection(!tabs.getSelection());
        }

    });
    spaces.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            tabs.setSelection(!spaces.getSelection());
        }

    });
    // Link to general text editor prefs from Eclipse - they can set tabs/spaces/whitespace drawing, etc
    Link link = new Link(appearanceComposite, SWT.NONE);
    link.setText(Messages.GeneralPreferencePage_GeneralTextEditorPrefLink);
    link.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            ((IWorkbenchPreferenceContainer) getContainer())
                    .openPage("org.eclipse.ui.preferencePages.GeneralTextEditor", null); //$NON-NLS-1$
        }

    });

    addTab(Messages.GeneralPreferencePage_Advanced);
    appearanceComposite = getFieldEditorParent();

    addField(new BooleanFieldEditor(IPreferenceConstants.ENABLE_WORD_WRAP,
            Messages.GeneralPreferencePage_EnableWordWrap, appearanceComposite));

    appearanceComposite = getFieldEditorParent();
    addField(new IntegerFieldEditor(IPreferenceConstants.COLORIZER_MAXCOLUMNS,
            Messages.GeneralPreferencePage_MaxColorizeColumns, appearanceComposite, 4));
    group = com.aptana.ide.core.ui.preferences.GeneralPreferencePage.createGroup(appearanceComposite,
            Messages.GeneralPreferencePage_CodeAssist);

    addField(new IntegerFieldEditor(IPreferenceConstants.CONTENT_ASSIST_DELAY,
            Messages.GeneralPreferencePage_DelayBeforeShowing, group, 4));
}

From source file:com.aptana.ide.scripting.preferences.GeneralPreferencePage.java

License:Open Source License

/**
 * Creates the field editors. Field editors are abstractions of the common GUI blocks needed to
 * manipulate various types of preferences. Each field editor knows how to save and restore
 * itself./*from   w ww  . j a  va2 s.  com*/
 */
public void createFieldEditors() {
    Composite c = createGroup(getFieldEditorParent(), "Server Preferences"); //$NON-NLS-1$
    addField(new BooleanFieldEditor(IPreferenceConstants.SCRIPTING_SERVER_START_AUTOMATICALLY,
            Messages.GeneralPreferencePage_LBL_StartScriptingServerOnStudioStartup, c));
    addField(new IntegerFieldEditor(IPreferenceConstants.SCRIPTING_SERVER_START_PORT,
            "Scripting server start port", c, 7)); //$NON-NLS-1$
}

From source file:com.boothen.jsonedit.preferences.WorkbenchPreferencePage.java

License:Open Source License

@Override
protected void createFieldEditors() {

    Boolean overrideTabSetting = getPreferenceStore().getBoolean(JsonPreferenceStore.OVERRIDE_TAB_SETTING);
    usePlatformTabSetting = new BooleanFieldEditor(JsonPreferenceStore.OVERRIDE_TAB_SETTING,
            "Override Workbench Tab Setting", getFieldEditorParent());
    addField(usePlatformTabSetting);//from  w ww. jav  a  2s . c o m
    usePlatformTabSetting.setPropertyChangeListener(this);

    spacesForTab = new BooleanFieldEditor(JsonPreferenceStore.SPACES_FOR_TABS, "Insert Spaces For Tabs",
            getFieldEditorParent());
    spacesForTab.setEnabled(overrideTabSetting, getFieldEditorParent());
    addField(spacesForTab);

    indentSpaces = new IntegerFieldEditor(JsonPreferenceStore.NUM_SPACES, "&Number of spaces to indent:",
            getFieldEditorParent(), 1);
    indentSpaces.setValidRange(0, 10);
    indentSpaces.setEnabled(overrideTabSetting, getFieldEditorParent());
    addField(indentSpaces);

    BooleanFieldEditor autoFormatOnSave = new BooleanFieldEditor(JsonPreferenceStore.AUTO_FORMAT_ON_SAVE,
            "Auto Format On Save", getFieldEditorParent());
    addField(autoFormatOnSave);

    ColorFieldEditor stringColor = new ColorFieldEditor(JsonPreferenceStore.STRING_COLOR,
            "&Key Attribute Color", getFieldEditorParent());
    addField(stringColor);

    ColorFieldEditor valueColor = new ColorFieldEditor(JsonPreferenceStore.VALUE_COLOR,
            "&Value Attribute Color", getFieldEditorParent());
    addField(valueColor);

    ColorFieldEditor nullColor = new ColorFieldEditor(JsonPreferenceStore.NULL_COLOR, "&Null Value Color",
            getFieldEditorParent());
    addField(nullColor);

    ColorFieldEditor defaultColor = new ColorFieldEditor(JsonPreferenceStore.DEFAULT_COLOR, "&Default Color",
            getFieldEditorParent());
    addField(defaultColor);
}

From source file:com.litrik.eclipse.xps.preferences.XPSPreferencePage.java

License:Apache License

public void createFieldEditors() {
    addField(new BooleanFieldEditor(XPSPreferenceConstants.P_JUNIT_ENABLED, JUNIT_ENABLED,
            getFieldEditorParent()));/*from   www .ja  v a 2  s  . c o  m*/

    // A group for the color preferences
    Group colorGroup = new Group(getFieldEditorParent(), SWT.NONE);
    colorGroup.setText(JUNIT_COLOR);

    // The color when a test run starts
    final LEDColorFieldEditor startLEDColorFieldEditor = new LEDColorFieldEditor(
            XPSPreferenceConstants.P_JUNIT_COLOR_START, JUNIT_COLOR_START, colorGroup);
    addField(startLEDColorFieldEditor);
    // A preview button
    final Button previewStartButton = new Button(colorGroup, SWT.NONE);
    previewStartButton.setText("Preview");

    // The color when a test run was successful
    final LEDColorFieldEditor successLEDColorFieldEditor = new LEDColorFieldEditor(
            XPSPreferenceConstants.P_JUNIT_COLOR_SUCCESS, JUNIT_COLOR_SUCCESS, colorGroup);
    addField(successLEDColorFieldEditor);
    // A preview button
    final Button previewSuccessButton = new Button(colorGroup, SWT.NONE);
    previewSuccessButton.setText("Preview");

    // The color when a test failed
    final LEDColorFieldEditor failureLEDColorFieldEditor = new LEDColorFieldEditor(
            XPSPreferenceConstants.P_JUNIT_COLOR_FAILURE, JUNIT_COLOR_FAILURE, colorGroup);
    addField(failureLEDColorFieldEditor);
    // A preview button
    final Button previewFailureButton = new Button(colorGroup, SWT.NONE);
    previewFailureButton.setText("Preview");

    // The brightness
    final ScaleFieldEditor brightnessScaleFieldEditor = new ScaleFieldEditor(
            XPSPreferenceConstants.P_JUNIT_BRIGHTNESS, JUNIT_BRIGHTNESS, colorGroup, 1, 7, 1, 1);
    addField(brightnessScaleFieldEditor);

    // Pulsate
    addField(new BooleanFieldEditor(XPSPreferenceConstants.P_JUNIT_PULSATE, JUNIT_PULSE, colorGroup));

    // Layout the group
    GridLayout colorGroupLayout = new GridLayout();
    colorGroupLayout.numColumns = 3;
    colorGroup.setLayout(colorGroupLayout);
    GridData colorGroupGridData = new GridData(GridData.FILL_HORIZONTAL);
    colorGroupGridData.horizontalSpan = 2;
    colorGroup.setLayoutData(colorGroupGridData);

    // A group for the time-out preferences
    Group timeOutGroup = new Group(getFieldEditorParent(), SWT.NONE);
    timeOutGroup.setText(JUNIT_TIMEOUT);

    // The time-out after success
    addField(new IntegerFieldEditor(XPSPreferenceConstants.P_JUNIT_TIMEOUT_SUCCESS, JUNIT_TIMEOUT_SUCCESS,
            timeOutGroup, 3));
    final Label secondsSuccessLabel = new Label(timeOutGroup, SWT.NONE);
    secondsSuccessLabel.setText(JUNIT_TIMEOUT_SECONDS);

    // The time-out after failure
    addField(new IntegerFieldEditor(XPSPreferenceConstants.P_JUNIT_TIMEOUT_FAILURE, JUNIT_TIMEOUT_FAILURE,
            timeOutGroup, 3));
    final Label secondsFailureLabel = new Label(timeOutGroup, SWT.NONE);
    secondsFailureLabel.setText(JUNIT_TIMEOUT_SECONDS);

    // Layout the group
    GridLayout timeOutGroupLayout = new GridLayout();
    timeOutGroupLayout.numColumns = 3;
    timeOutGroup.setLayout(timeOutGroupLayout);
    GridData timeOutGroupGridData = new GridData(GridData.FILL_HORIZONTAL);
    timeOutGroupGridData.horizontalSpan = 2;
    timeOutGroup.setLayoutData(timeOutGroupGridData);

    // A group for the LED location preferences
    Group locationGroup = new Group(getFieldEditorParent(), SWT.NONE);
    locationGroup.setText(JUNIT_LOCATION);

    // Fan LEDs
    final BooleanFieldEditor fansBooleanFieldEditor = new BooleanFieldEditor(
            XPSPreferenceConstants.P_JUNIT_LOCATION_FANS, JUNIT_LOCATION_FANS, locationGroup);
    addField(fansBooleanFieldEditor);

    // Speaker LEDs
    final BooleanFieldEditor speakersBooleanFieldEditor = new BooleanFieldEditor(
            XPSPreferenceConstants.P_JUNIT_LOCATION_SPEAKERS, JUNIT_LOCATION_SPEAKERS, locationGroup);
    addField(speakersBooleanFieldEditor);

    // Panel back LEDs
    final BooleanFieldEditor panelBooleanFieldEditor = new BooleanFieldEditor(
            XPSPreferenceConstants.P_JUNIT_LOCATION_PANEL, JUNIT_LOCATION_PANEL, locationGroup);
    addField(panelBooleanFieldEditor);

    // Layout the group
    GridLayout locationGroupLayout = new GridLayout();
    locationGroup.setLayout(locationGroupLayout);
    GridData locationGroupGridData = new GridData(GridData.FILL_HORIZONTAL);
    locationGroupGridData.horizontalSpan = 2;
    locationGroup.setLayoutData(locationGroupGridData);

    // Let the "Preview" buttons do something
    previewStartButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent se) {
            try {
                LEDs.setLeds(startLEDColorFieldEditor.getCurrentValue(),
                        fansBooleanFieldEditor.getBooleanValue(), speakersBooleanFieldEditor.getBooleanValue(),
                        panelBooleanFieldEditor.getBooleanValue(),
                        brightnessScaleFieldEditor.getScaleControl().getSelection());
            } catch (LEDException e) {
                Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, Status.OK,
                        "An unexpected error occurred when setting the XPS LEDs.", e));
            }
        }
    });
    previewSuccessButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent se) {
            try {
                LEDs.setLeds(successLEDColorFieldEditor.getCurrentValue(),
                        fansBooleanFieldEditor.getBooleanValue(), speakersBooleanFieldEditor.getBooleanValue(),
                        panelBooleanFieldEditor.getBooleanValue(),
                        brightnessScaleFieldEditor.getScaleControl().getSelection());
            } catch (LEDException e) {
                Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, Status.OK,
                        "An unexpected error occurred when setting the XPS LEDs.", e));
            }
        }
    });
    previewFailureButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent se) {
            try {
                LEDs.setLeds(failureLEDColorFieldEditor.getCurrentValue(),
                        fansBooleanFieldEditor.getBooleanValue(), speakersBooleanFieldEditor.getBooleanValue(),
                        panelBooleanFieldEditor.getBooleanValue(),
                        brightnessScaleFieldEditor.getScaleControl().getSelection());
            } catch (LEDException e) {
                Activator.getDefault().getLog().log(
                        new Status(IStatus.ERROR, Activator.PLUGIN_ID, Status.OK, LEDException.MESSAGE, e));
            }
        }
    });

}

From source file:com.palantir.typescript.FormatterPreferencePage.java

License:Apache License

@Override
protected void createFieldEditors() {
    this.addField(new BooleanFieldEditor(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS,
            getResource("preferences.editor.convert.tabs.to.spaces"), getFieldEditorParent()));

    this.addField(new IntegerFieldEditor(IPreferenceConstants.EDITOR_INDENT_SIZE,
            getResource("preferences.editor.indent.size"), getFieldEditorParent(), 1));

    this.addField(new IntegerFieldEditor(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH,
            getResource("preferences.editor.tab.size"), getFieldEditorParent(), 1));

    this.addField(new BooleanFieldEditor(IPreferenceConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_DELIMITER,
            getResource("preferences.formatter.insert.space.after.comma.delimiter"), getFieldEditorParent()));

    this.addField(new BooleanFieldEditor(
            IPreferenceConstants.FORMATTER_INSERT_SPACE_AFTER_SEMICOLON_IN_FOR_STATEMENTS,
            getResource("preferences.formatter.insert.space.after.semicolon.in.for.statements"),
            getFieldEditorParent()));/*from   w w  w  . j  a v a2  s.c  o m*/

    this.addField(new BooleanFieldEditor(
            IPreferenceConstants.FORMATTER_INSERT_SPACE_BEFORE_AND_AFTER_BINARY_OPERATORS,
            getResource("preferences.formatter.insert.space.before.and.after.binary.operators"),
            getFieldEditorParent()));

    this.addField(new BooleanFieldEditor(
            IPreferenceConstants.FORMATTER_INSERT_SPACE_AFTER_KEYWORDS_IN_CONTROL_FLOW_STATEMENTS,
            getResource("preferences.formatter.insert.space.after.keywords.in.control.flow.statements"),
            getFieldEditorParent()));

    this.addField(new BooleanFieldEditor(
            IPreferenceConstants.FORMATTER_INSERT_SPACE_AFTER_FUNCTION_KEYWORD_FOR_ANONYMOUS_FUNCTIONS,
            getResource("preferences.formatter.insert.space.after.function.keyword.for.anonymous.functions"),
            getFieldEditorParent()));

    this.addField(new BooleanFieldEditor(
            IPreferenceConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_AND_BEFORE_CLOSING_NONEMPTY_PARENTHESIS,
            getResource(
                    "preferences.formatter.insert.space.after.opening.and.before.closing.nonempty.parenthesis"),
            getFieldEditorParent()));

    this.addField(
            new BooleanFieldEditor(IPreferenceConstants.FORMATTER_PLACE_OPEN_BRACE_ON_NEW_LINE_FOR_FUNCTIONS,
                    getResource("preferences.formatter.place.open.brace.on.new.line.for.functions"),
                    getFieldEditorParent()));

    this.addField(new BooleanFieldEditor(
            IPreferenceConstants.FORMATTER_PLACE_OPEN_BRACE_ON_NEW_LINE_FOR_CONTROL_BLOCKS,
            getResource("preferences.formatter.place.open.brace.on.new.line.for.control.blocks"),
            getFieldEditorParent()));
}

From source file:com.palantir.typescript.preferences.FormatterPreferencePage.java

License:Apache License

@Override
protected void createFieldEditors() {
    this.addField(new BooleanFieldEditor(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS,
            getResource("preferences.editor.convert.tabs.to.spaces"), this.getFieldEditorParent()));

    this.addField(new IntegerFieldEditor(IPreferenceConstants.EDITOR_INDENT_SIZE,
            getResource("preferences.editor.indent.size"), this.getFieldEditorParent(), 1));

    this.addField(new IntegerFieldEditor(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH,
            getResource("preferences.editor.tab.size"), this.getFieldEditorParent(), 1));

    this.addField(new BooleanFieldEditor(IPreferenceConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_DELIMITER,
            getResource("preferences.formatter.insert.space.after.comma.delimiter"),
            this.getFieldEditorParent()));

    this.addField(new BooleanFieldEditor(
            IPreferenceConstants.FORMATTER_INSERT_SPACE_AFTER_SEMICOLON_IN_FOR_STATEMENTS,
            getResource("preferences.formatter.insert.space.after.semicolon.in.for.statements"),
            this.getFieldEditorParent()));

    this.addField(new BooleanFieldEditor(
            IPreferenceConstants.FORMATTER_INSERT_SPACE_BEFORE_AND_AFTER_BINARY_OPERATORS,
            getResource("preferences.formatter.insert.space.before.and.after.binary.operators"),
            this.getFieldEditorParent()));

    this.addField(new BooleanFieldEditor(
            IPreferenceConstants.FORMATTER_INSERT_SPACE_AFTER_KEYWORDS_IN_CONTROL_FLOW_STATEMENTS,
            getResource("preferences.formatter.insert.space.after.keywords.in.control.flow.statements"),
            this.getFieldEditorParent()));

    this.addField(new BooleanFieldEditor(
            IPreferenceConstants.FORMATTER_INSERT_SPACE_AFTER_FUNCTION_KEYWORD_FOR_ANONYMOUS_FUNCTIONS,
            getResource("preferences.formatter.insert.space.after.function.keyword.for.anonymous.functions"),
            this.getFieldEditorParent()));

    this.addField(new BooleanFieldEditor(
            IPreferenceConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_AND_BEFORE_CLOSING_NONEMPTY_PARENTHESIS,
            getResource(// ww  w.  j  a v  a 2s  . c om
                    "preferences.formatter.insert.space.after.opening.and.before.closing.nonempty.parenthesis"),
            this.getFieldEditorParent()));

    this.addField(new BooleanFieldEditor(
            IPreferenceConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_AND_BEFORE_CLOSING_TEMPLATE_STRING_BRACES,
            getResource(
                    "preferences.formatter.insert.space.after.opening.and.before.closing.template.string.braces"),
            this.getFieldEditorParent()));

    this.addField(
            new BooleanFieldEditor(IPreferenceConstants.FORMATTER_PLACE_OPEN_BRACE_ON_NEW_LINE_FOR_FUNCTIONS,
                    getResource("preferences.formatter.place.open.brace.on.new.line.for.functions"),
                    this.getFieldEditorParent()));

    this.addField(new BooleanFieldEditor(
            IPreferenceConstants.FORMATTER_PLACE_OPEN_BRACE_ON_NEW_LINE_FOR_CONTROL_BLOCKS,
            getResource("preferences.formatter.place.open.brace.on.new.line.for.control.blocks"),
            this.getFieldEditorParent()));
}

From source file:com.python.pydev.debug.ui.DebugPreferencesPageExt.java

License:Open Source License

public void createFieldEditors(DebugPrefsPage page, Composite parent) {
    page.addField(new IntegerFieldEditor(DebugPluginPrefsInitializer.PYDEV_REMOTE_DEBUGGER_PORT,
            "Port for remote debugger:", parent, 10));

    ComboFieldEditor editor = new ComboFieldEditor(DebugPluginPrefsInitializer.DEBUG_SERVER_STARTUP,
            "Remote debugger server activation: ", ENTRIES_AND_VALUES_DEBUGGER_STARTUP, parent);
    page.addField(editor);//w w w.j  a va 2 s  .  co  m
    editor.getLabelControl(parent).setToolTipText(
            "This option marks if the remote debugger should be auto-activated in some situation.");

    ComboFieldEditor comboEditor = new ComboFieldEditor(
            DebugPluginPrefsInitializer.FORCE_SHOW_SHELL_ON_BREAKPOINT, "On breakpoint hit: ",
            ENTRIES_AND_VALUES, parent);

    page.addField(comboEditor);
    comboEditor.getLabelControl(parent).setToolTipText(
            "Checking this option will force Eclipse to have focus when a PyDev breakpoint is hit.");

}