Example usage for org.eclipse.jface.preference RadioGroupFieldEditor getLabelControl

List of usage examples for org.eclipse.jface.preference RadioGroupFieldEditor getLabelControl

Introduction

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

Prototype

public Label getLabelControl(Composite parent) 

Source Link

Document

Returns this field editor's label component.

Usage

From source file:net.tourbook.device.polar.hrm.PrefPagePolar.java

License:Open Source License

private void createUI10TitleDescription(final Composite parent) {

    RadioGroupFieldEditor editor;
    _groupTitleDescription = new Group(parent, SWT.NONE);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(_groupTitleDescription);
    _groupTitleDescription.setText(Messages.PrefPage_Polar_Group_TitleDescription);
    {/*w  w  w . ja va2 s . com*/
        /*
         * radio: altitude
         */
        editor = new RadioGroupFieldEditor(IPreferences.TITLE_DESCRIPTION,
                Messages.PrefPage_Polar_Field_TitleDescription, 1,
                new String[][] {
                        new String[] { Messages.PrefPage_Polar_Radio_TitleFromTitle,
                                IPreferences.TITLE_DESCRIPTION_TITLE_FROM_TITLE },
                        new String[] { Messages.PrefPage_Polar_Radio_TitleFromDescription,
                                IPreferences.TITLE_DESCRIPTION_TITLE_FROM_DESCRIPTION }, },
                _groupTitleDescription, false);
        addField(editor);

    }

    // force layout after the fields are set !!!
    GridLayoutFactory.swtDefaults().numColumns(2).applyTo(_groupTitleDescription);

    final Label editorControl = editor.getLabelControl(_groupTitleDescription);
    GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.TOP).applyTo(editorControl);
}

From source file:org.robotframework.ide.eclipse.main.plugin.preferences.SuiteEditorPreferencePage.java

License:Apache License

private void createSourceSettingsGroup(final Composite parent) {
    final Group sourceGroup = new Group(parent, SWT.NONE);
    sourceGroup.setText("Source");
    GridDataFactory.fillDefaults().indent(0, 20).grab(true, false).span(2, 1).applyTo(sourceGroup);
    GridLayoutFactory.fillDefaults().applyTo(sourceGroup);

    final RadioGroupFieldEditor editors = new RadioGroupFieldEditor(RedPreferences.SEPARATOR_MODE,
            "When Tab key is pressed in source editor", 1, createTabPressLabelsAndValues(), sourceGroup);
    addField(editors);/*from   w w w .  j  a va2 s .  co m*/
    GridDataFactory.fillDefaults().indent(5, 5).applyTo(editors.getLabelControl(sourceGroup));

    final String regex = "^(ss+)|t+|((s|t)+\\|(s|t)+)$";
    final RegexValidatedStringFieldEditor separatorEditor = new RegexValidatedStringFieldEditor(
            RedPreferences.SEPARATOR_TO_USE, "user defined separator (use '|', 's' for space or 't' for tab)",
            regex, sourceGroup);
    separatorEditor.setErrorMessage(
            "User defined separator should have at least one tab or two spaces, or bar '|' surrounded "
                    + "with at least one space or tab");
    addField(separatorEditor);
    GridDataFactory.fillDefaults().indent(5, 0).applyTo(separatorEditor.getLabelControl(sourceGroup));
    final SeparatorsMode currentMode = SeparatorsMode
            .valueOf(getPreferenceStore().getString(RedPreferences.SEPARATOR_MODE));
    separatorEditor.setEnabled(currentMode != SeparatorsMode.ALWAYS_TABS, sourceGroup);

    enablementUpdater = new Function<PropertyChangeEvent, Void>() {

        @Override
        public Void apply(final PropertyChangeEvent event) {
            if (event.getSource() == editors) {
                final SeparatorsMode newMode = SeparatorsMode.valueOf((String) event.getNewValue());
                separatorEditor.setEnabled(newMode != SeparatorsMode.ALWAYS_TABS, sourceGroup);
            }
            return null;
        }
    };
}