Example usage for org.eclipse.jface.preference BooleanFieldEditor getDescriptionControl

List of usage examples for org.eclipse.jface.preference BooleanFieldEditor getDescriptionControl

Introduction

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

Prototype

public Control getDescriptionControl(Composite parent) 

Source Link

Document

Returns the control responsible for displaying this field editor's label.

Usage

From source file:com.ggasoftware.indigo.knime.plugin.IndigoPreferencePage.java

License:Open Source License

@Override
protected void createFieldEditors() {
    final Composite parent = getFieldEditorParent();

    final BooleanFieldEditor enableRenderer = new BooleanFieldEditor(
            IndigoPreferenceInitializer.PREF_ENABLE_RENDERER, "Enable rendering", parent);
    final BooleanFieldEditor coloredRendering = new BooleanFieldEditor(
            IndigoPreferenceInitializer.PREF_COLORING, "Colored rendering", parent);
    final BooleanFieldEditor showImplH = new BooleanFieldEditor(
            IndigoPreferenceInitializer.PREF_SHOW_IMPLICIT_HYDROGENS, "Show implicit hydrogens", parent);
    final IntegerFieldEditor bondLength = new IntegerFieldEditor(IndigoPreferenceInitializer.PREF_BOND_LENGTH,
            "Desired bond length in pixels", parent);
    final IntegerFieldEditor imageWidth = new IntegerFieldEditor(
            IndigoPreferenceInitializer.PREF_MOL_IMAGE_WIDTH, "Molecule image width in pixels", parent);
    final IntegerFieldEditor imageHeight = new IntegerFieldEditor(
            IndigoPreferenceInitializer.PREF_MOL_IMAGE_HEIGHT, "Molecule image height in pixels", parent);

    ((Button) enableRenderer.getDescriptionControl(parent)).addSelectionListener(new SelectionListener() {
        @Override/*from w w  w.j a  va2  s.c  o  m*/
        public void widgetSelected(SelectionEvent e) {
            boolean enabled = enableRenderer.getBooleanValue();

            coloredRendering.setEnabled(enabled, parent);
            showImplH.setEnabled(enabled, parent);
            bondLength.setEnabled(enabled, parent);
            imageWidth.setEnabled(enabled, parent);
            imageHeight.setEnabled(enabled, parent);
        }

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

    addField(enableRenderer);

    boolean enabled = IndigoPlugin.getDefault().getPreferenceStore()
            .getBoolean(IndigoPreferenceInitializer.PREF_ENABLE_RENDERER);

    addField(coloredRendering);
    addField(showImplH);
    addField(bondLength);
    addField(imageWidth);
    addField(imageHeight);

    coloredRendering.setEnabled(enabled, parent);
    showImplH.setEnabled(enabled, parent);
    bondLength.setEnabled(enabled, parent);
    imageWidth.setEnabled(enabled, parent);
    imageHeight.setEnabled(enabled, parent);
}

From source file:com.twinsoft.convertigo.eclipse.preferences.StudioPreferencePage.java

License:Open Source License

protected Control createContents(Composite parent) {
    Composite top = new Composite(parent, SWT.NONE);
    top.setLayout(new GridLayout(1, false));

    // General options
    Group groupGeneral = new Group(top, SWT.SHADOW_IN);
    groupGeneral.setText("General options");
    groupGeneral.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    intTracePlayerPort = new IntegerFieldEditor(ConvertigoPlugin.PREFERENCE_TRACEPLAYER_PORT,
            "Trace player listening port", groupGeneral);
    intTracePlayerPort.setPage(this);
    intTracePlayerPort.setPreferenceStore(getPreferenceStore());
    intTracePlayerPort.load();//from   w w w . j ava2 s.  c  o  m

    cbHighlight = new BooleanFieldEditor(ConvertigoPlugin.PREFERENCE_TREE_HIGHLIGHT_DETECTED,
            "Highlight detected objects in tree", groupGeneral);
    cbHighlight.setPage(this);
    cbHighlight.setPreferenceStore(getPreferenceStore());
    cbHighlight.load();

    cbIgnoreNews = new BooleanFieldEditor(ConvertigoPlugin.PREFERENCE_IGNORE_NEWS,
            "Automatically dismiss the splashscreen", groupGeneral);
    cbIgnoreNews.setPage(this);
    cbIgnoreNews.setPreferenceStore(getPreferenceStore());
    cbIgnoreNews.load();

    cbShowEngineOnConsole = new BooleanFieldEditor(ConvertigoPlugin.PREFERENCE_SHOW_ENGINE_INTO_CONSOLE,
            "Show Engine logs into Console view", groupGeneral);
    cbShowEngineOnConsole.setPage(this);
    cbShowEngineOnConsole.setPreferenceStore(getPreferenceStore());
    cbShowEngineOnConsole.load();

    cbEngineLoadAllProjects = new BooleanFieldEditor(ConvertigoPlugin.PREFERENCE_ENGINE_LOAD_ALL_PROJECTS,
            "Engine loads all projects even if closed", groupGeneral);
    cbEngineLoadAllProjects.setPage(this);
    cbEngineLoadAllProjects.setPreferenceStore(getPreferenceStore());
    cbEngineLoadAllProjects.load();

    // Diagnostics
    Group groupDiagnostics = new Group(top, SWT.SHADOW_IN);
    groupDiagnostics.setText("Diagnostics");

    comboLevel = new ComboFieldEditor(ConvertigoPlugin.PREFERENCE_LOG_LEVEL, "Trace level",
            new String[][] { { "Errors", "0" }, { "Exceptions", "1" }, { "Warnings", "2" }, { "Messages", "3" },
                    { "Debug", "4" }, { "Debug+", "5" }, { "Debug++", "6" } },
            groupDiagnostics);

    comboLevel.setPage(this);
    comboLevel.setPreferenceStore(getPreferenceStore());
    comboLevel.load();

    Group groupLocalBuild = new Group(top, SWT.SHADOW_IN);
    groupLocalBuild.setText("Local Build");
    groupLocalBuild.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    localBuildAdditionalPath = new StringFieldEditor(ConvertigoPlugin.PREFERENCE_LOCAL_BUILD_ADDITIONAL_PATH,
            "Additional PATH (folders separated by '" + File.pathSeparator + "')", groupLocalBuild);
    localBuildAdditionalPath.setPage(this);
    localBuildAdditionalPath.setPreferenceStore(getPreferenceStore());
    localBuildAdditionalPath.load();

    BooleanFieldEditor btest = new BooleanFieldEditor("", "", groupLocalBuild);
    btest.getDescriptionControl(groupLocalBuild).setVisible(false);

    return top;
}

From source file:gov.nasa.ensemble.common.ui.preferences.AbstractPreferencePage.java

License:Open Source License

protected void indent(BooleanFieldEditor editor, Composite parent) {
    Control control = editor.getDescriptionControl(parent);
    GridData layoutData = (GridData) control.getLayoutData();
    if (layoutData == null) {
        control.setLayoutData(layoutData = new GridData());
    }/*from   w  ww  .ja v a 2  s  . co  m*/
    layoutData.horizontalIndent = 20;
}

From source file:hu.bme.mit.massif.simulink.importer.ui.dialogs.ImportSettingsDialog.java

License:Open Source License

@Override
protected List<FieldEditor> additionalFields(Composite fieldEditorParent) {
    Label filters = new Label(fieldEditorParent, SWT.NONE);
    filters.setText("Import filters to use:");

    List<FieldEditor> fes = new LinkedList<FieldEditor>();

    Map<String, ISimulinkImportFilter> filtersById = ImportFilterRegistry.INSTANCE.getFiltersById();
    for (String filterId : filtersById.keySet()) {
        ISimulinkImportFilter filter = filtersById.get(filterId);
        BooleanFieldEditor filterCheckbox = new BooleanFieldEditor(filterId, filter.getName(),
                fieldEditorParent);/*from   www .  ja  v  a 2 s.  c  om*/
        filterCheckbox.setPreferenceStore(store);
        filterCheckbox.setPreferenceName(filterId);
        filterCheckbox.load();
        filterCheckbox.getDescriptionControl(fieldEditorParent).setToolTipText(filter.getDescription());
        fes.add(filterCheckbox);
        filterSelectors.put(filterId, filterCheckbox);
    }

    importedModelNameEditor = new StringFieldEditor("", "Result Model Name:", fieldEditorParent);
    importedModelNameEditor.setEmptyStringAllowed(false);
    importedModelNameEditor.setStringValue(importedModelName);
    fes.add(importedModelNameEditor);

    return fes;
}

From source file:hu.bme.mit.massif.simulink.importer.ui.preferences.ImporterPreferencePage.java

License:Open Source License

/**
 * Creates the field editors.// w  w  w .  j a v a2 s  .  c o m
 */
public void createFieldEditors() {

    Label traverseModeInformation = new Label(getFieldEditorParent(), SWT.NONE);
    traverseModeInformation.setBounds(new Rectangle(0, 0, 300, 30));
    traverseModeInformation.setText(
            "Set the traversal strategy of the importer." + "\nCases differ in handling model references.");

    // Traverse mode
    RadioGroupFieldEditor importModePickerEditor = new RadioGroupFieldEditor(
            PreferenceConstants.IMPORT_TRAVERSE_MODE, "Traverse mode:", 1,
            new String[][] {
                    { "&Shallow (only the model reference block is imported)", ImportMode.SHALLOW.toString() },
                    { "&Deep (the models referred by the imported model are also imported as an individual model)",
                            ImportMode.DEEP.toString() },
                    { "&Flattening (the model references are resolved and are imported as though they were part of the same model)",
                            ImportMode.FLATTENING.toString() },
                    { "&Referencing (all linked subsystem blocks' library is imported as an individual model)",
                            ImportMode.REFERENCING.toString() } },
            getFieldEditorParent());
    addField(importModePickerEditor);

    Label modelPathInformationPlaceholder = new Label(getFieldEditorParent(), SWT.NONE);
    modelPathInformationPlaceholder.setBounds(new Rectangle(0, 0, 300, 15));
    modelPathInformationPlaceholder.setText("");
    Label modelPathInformation = new Label(getFieldEditorParent(), SWT.NONE);
    modelPathInformation.setBounds(new Rectangle(0, 0, 400, 30));
    modelPathInformation.setText("You can provide a default path for the imported models."
            + "\nIf empty, you will be prompted for the required information at import time.");

    // Result model path
    ContainerFieldEditor resultModelPathEditor = new ContainerFieldEditor(
            PreferenceConstants.IMPORT_RESULT_MODEL_PATH, "Default result model location:",
            getFieldEditorParent());

    // A horizontal separator on the page
    SeparatorFieldEditor separator = new SeparatorFieldEditor(getFieldEditorParent());
    addField(separator);

    // Import filter
    // TODO magic string elimination
    Label filterInformation = new Label(getFieldEditorParent(), SWT.NONE);
    filterInformation.setBounds(new Rectangle(0, 0, 300, 15));
    filterInformation.setText("Import filters to use by default:");

    Map<String, ISimulinkImportFilter> filtersById = ImportFilterRegistry.INSTANCE.getFiltersById();
    for (String filterId : filtersById.keySet()) {
        ISimulinkImportFilter filter = filtersById.get(filterId);
        Composite filterCheckboxParent = getFieldEditorParent();
        BooleanFieldEditor filterCheckbox = new BooleanFieldEditor(filterId, filter.getName(),
                filterCheckboxParent);
        filterCheckbox.getDescriptionControl(filterCheckboxParent).setToolTipText(filter.getDescription());
        addField(filterCheckbox);
    }

    // TODO set this, makes the setting more user friendly
    // resultModelPathEditor.setFilterPath(path);

    addField(resultModelPathEditor);

    Label additionalMatlabPathInformation = new Label(getFieldEditorParent(), SWT.NONE);
    additionalMatlabPathInformation.setBounds(new Rectangle(0, 0, 400, 30));
    additionalMatlabPathInformation
            .setText("You can provide additional path that are to be added to the Matlab Path."
                    + "\nIf you provide multiple paths, separate them with '|'.");

    // Additional MATLAB path
    addField(new StringFieldEditor(PreferenceConstants.IMPORT_ADDITIONAL_MATLAB_PATH, "Additional Matlab path:",
            getFieldEditorParent()));

    Label startupScriptInformation = new Label(getFieldEditorParent(), SWT.NONE);
    startupScriptInformation.setBounds(new Rectangle(0, 0, 400, 30));
    startupScriptInformation
            .setText("You can provide additional startup scripts that are to be executed in Matlab."
                    + "\nIf you provide multiple script names, separate them with '|'.");

    // Additional MATLAB script names
    addField(new StringFieldEditor(PreferenceConstants.IMPORT_STARTUP_SCRIPTS, "Startup script names:",
            getFieldEditorParent()));

}

From source file:org.csstudio.opibuilder.preferences.CommonPreferencePage.java

License:Open Source License

@Override
protected void createFieldEditors() {
    final Composite parent = getFieldEditorParent();

    WorkspaceFileFieldEditor colorEditor = new WorkspaceFileFieldEditor(PreferencesHelper.COLOR_FILE,
            "Color File: ", new String[] { "def" }, parent);//$NON-NLS-2$
    addField(colorEditor);//  w  ww . j  av a 2 s  . c  o m

    WorkspaceFileFieldEditor fontEditor = new WorkspaceFileFieldEditor(PreferencesHelper.FONT_FILE,
            "Font File: ", new String[] { "def" }, parent);//$NON-NLS-2$
    addField(fontEditor);

    StringFieldEditor opiSearchPathEditor = new StringFieldEditor(PreferencesHelper.OPI_SEARCH_PATH,
            "OPI Search Path", parent);
    opiSearchPathEditor.getTextControl(parent).setToolTipText("The path to search OPI files.");
    addField(opiSearchPathEditor);

    StringFieldEditor topOPIsEditor = new StringFieldEditor(PreferencesHelper.TOP_OPIS, "Top OPIs", parent);
    topOPIsEditor.getTextControl(parent).setToolTipText("The OPIs appeared in top opi button on toolbar");
    addField(topOPIsEditor);

    WorkspaceFileFieldEditor probeOPIEditor = new WorkspaceFileFieldEditor(PreferencesHelper.PROBE_OPI,
            "Probe OPI: ", new String[] { "opi" }, parent);//$NON-NLS-2$
    probeOPIEditor.getTextControl(parent)
            .setToolTipText("The opi file to be invoked from CSS->OPI Probe context menu");
    addField(probeOPIEditor);

    BooleanFieldEditor noEditModeEditor = new BooleanFieldEditor(PreferencesHelper.NO_EDIT, "No-Editing mode",
            parent);
    addField(noEditModeEditor);

    BooleanFieldEditor showOpiRuntimeStacks = new BooleanFieldEditor(PreferencesHelper.SHOW_OPI_RUNTIME_STACKS,
            "Show OPI Runtime Stacks", parent);
    showOpiRuntimeStacks.getDescriptionControl(parent).setToolTipText(
            "Enable to add placeholders to new OPI Runtime perspective " + "as an aid to positioning displays");
    addField(showOpiRuntimeStacks);

    BooleanFieldEditor advanceGraphicsEditor = new BooleanFieldEditor(
            PreferencesHelper.DISABLE_ADVANCED_GRAPHICS, "Disable Advanced Graphics", parent);
    advanceGraphicsEditor.getDescriptionControl(parent)
            .setToolTipText("This will disable alpha, anti-alias and gradient effect. "
                    + "OPI need to be re-opened to make this take effect.");
    addField(advanceGraphicsEditor);

    BooleanFieldEditor displaySysOutEditor = new BooleanFieldEditor(PreferencesHelper.DISPLAY_SYSTEM_OUTPUT,
            "Display system output to BOY Console", parent);
    displaySysOutEditor.getDescriptionControl(parent)
            .setToolTipText("Enable this may result in undesired \ninformation displayed in BOY Console.");
    addField(displaySysOutEditor);

    BooleanFieldEditor default_type_editor = new BooleanFieldEditor(PreferencesHelper.DEFAULT_TO_CLASSIC_STYLE,
            "Default to 'classic' widget style", parent);
    default_type_editor.getDescriptionControl(parent)
            .setToolTipText("Should widgets with 'classic' as well as 'native' style default to 'classic'?");
    addField(default_type_editor);

    IntegerFieldEditor urlLoadFieldEditor = new IntegerFieldEditor(PreferencesHelper.URL_FILE_LOADING_TIMEOUT,
            "URL file loading timeout (ms)", parent);
    urlLoadFieldEditor.getTextControl(parent)
            .setToolTipText("The timeout in millisecond for loading file from a URL path.");
    addField(urlLoadFieldEditor);

}

From source file:org.csstudio.opibuilder.validation.ui.PreferencesPage.java

License:Open Source License

@Override
protected void createFieldEditors() {
    final Composite parent = getFieldEditorParent();

    WorkspaceFileFieldEditor rules = new WorkspaceFileFieldEditor(Activator.PREF_RULES_FILE,
            "Validation Rules: ", new String[] { "def" }, parent);
    rules.getTextControl(parent).setToolTipText(
            "The file that defines the rules for validation of properties (read-only, write, read/write)");
    addField(rules);//  ww  w .java  2s  .  c om

    BooleanFieldEditor askForBackup = new BooleanFieldEditor(Activator.PREF_SHOW_BACKUP_DIALOG,
            "Ask to do backup before applying quick fix?", parent) {
        private Button button;

        @Override
        protected Button getChangeControl(Composite parent) {
            if (button == null) {
                button = super.getChangeControl(parent);
                button.addSelectionListener(new SelectionListener() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {
                        makeBackup.setEnabled(!getBooleanValue(), parent);
                    }

                    @Override
                    public void widgetDefaultSelected(SelectionEvent e) {
                    }
                });
            }
            return button;
        }
    };
    addField(askForBackup);

    makeBackup = new BooleanFieldEditor(Activator.PREF_DO_BACKUP, "Do backup when applying quick fix?", parent);
    makeBackup.setEnabled(!Activator.getInstance().isShowBackupDialog(), parent);
    addField(makeBackup);

    BooleanFieldEditor showSummary = new BooleanFieldEditor(Activator.PREF_SHOW_SUMMARY,
            "Show summary dialog after validation?", parent);
    addField(showSummary);

    BooleanFieldEditor nestMarkers = new BooleanFieldEditor(Activator.PREF_NEST_MARKERS,
            "Nest markers in the Problems View?", parent);
    nestMarkers.getDescriptionControl(parent).setToolTipText(
            "Display sub validation failures (action, script, rule) as children of their parent properties (actions, scripts, rules).");
    addField(nestMarkers);

    BooleanFieldEditor clearMarkers = new BooleanFieldEditor(Activator.PREF_CLEAR_MARKERS,
            "Clear old markers when validation starts?", parent);
    clearMarkers.getDescriptionControl(parent)
            .setToolTipText("Clear all validation markers on every new validation restart");
    addField(clearMarkers);

    BooleanFieldEditor useDefaultEditor = new BooleanFieldEditor(Activator.PREF_CLEAR_MARKERS,
            "Display markers in default editor?", parent);
    useDefaultEditor.getDescriptionControl(parent).setToolTipText(
            "If checked a validation marker will be displayed in the default editor. If unchecked, the marker will "
                    + "always be displayed in the text editor.");
    addField(useDefaultEditor);

    BooleanFieldEditor saveResourcesEditor = new BooleanFieldEditor(Activator.PREF_SAVE_BEFORE_VALIDATION,
            "Save all modified resources automatically prior to validation?", parent);
    addField(saveResourcesEditor);

    BooleanFieldEditor warnAboutJythonScriptsEditor = new BooleanFieldEditor(
            Activator.PREF_WARN_ABOUT_JYTHON_SCRIPTS, "Warn whenever a jython script is attached to a widget?",
            parent);
    addField(warnAboutJythonScriptsEditor);
}

From source file:org.dawnsci.plotting.system.preference.ErrorBarPreferencePage.java

License:Open Source License

@Override
protected void createFieldEditors() {

    BooleanFieldEditor bfe = new BooleanFieldEditor(PlottingConstants.GLOBAL_SHOW_ERROR_BARS,
            "Show error bars (global setting)", getFieldEditorParent());
    addField(bfe);/*from w w  w  .j  a  v a2s  . co m*/

    final IntegerFieldEditor sizeEditor = new IntegerFieldEditor(PlottingConstants.AUTO_HIDE_ERROR_SIZE,
            "Number of traces to automatically set error bars off", getFieldEditorParent());
    addField(sizeEditor);
    sizeEditor.setValidRange(2, 1000);
    sizeEditor.setEnabled(getPreferenceStore().getBoolean(PlottingConstants.GLOBAL_SHOW_ERROR_BARS),
            getFieldEditorParent());

    final Button button = (Button) bfe.getDescriptionControl(getFieldEditorParent());
    button.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            sizeEditor.setEnabled(button.getSelection(), getFieldEditorParent());
        }
    });

}

From source file:org.eclipse.cdt.internal.autotools.ui.properties.AutotoolsCategoryPropertyOptionPage.java

License:Open Source License

protected void createFieldEditors() {
    super.createFieldEditors();
    Composite parent = getFieldEditorParent();
    //      FontMetrics fm = AbstractCPropertyTab.getFontMetrics(parent);
    AutotoolsConfiguration.Option[] options = AutotoolsConfiguration.getChildOptions(catName);
    for (int i = 0; i < options.length; ++i) {
        AutotoolsConfiguration.Option option = options[i];
        switch (option.getType()) {
        case IConfigureOption.STRING:
        case IConfigureOption.INTERNAL:
        case IConfigureOption.MULTIARG:
            parent = getFieldEditorParent();
            StringFieldEditor f = new StringFieldEditor(option.getName(), option.getDescription(), 20, parent);
            f.getLabelControl(parent).setToolTipText(option.getToolTip());
            addField(f);//from  ww w .  jav  a2  s  . c o  m
            fieldEditors.add(f);
            break;
        case IConfigureOption.BIN:
        case IConfigureOption.FLAGVALUE:
            parent = getFieldEditorParent();
            BooleanFieldEditor b = new BooleanFieldEditor(option.getName(), option.getDescription(), parent);
            b.getDescriptionControl(parent).setToolTipText(option.getToolTip());
            addField(b);
            fieldEditors.add(b);
            break;
        case IConfigureOption.FLAG:
            parent = getFieldEditorParent();
            FieldEditor l = createLabelEditor(parent, option.getName());
            addField(l);
            fieldEditors.add(l);
            break;
        }
    }
}

From source file:org.eclipse.egit.ui.internal.preferences.CommitDialogPreferencePage.java

License:Open Source License

@Override
protected void createFieldEditors() {
    BooleanFieldEditor hardWrap = new BooleanFieldEditor(UIPreferences.COMMIT_DIALOG_HARD_WRAP_MESSAGE,
            UIText.CommitDialogPreferencePage_hardWrapMessage, getFieldEditorParent());
    hardWrap.getDescriptionControl(getFieldEditorParent())
            .setToolTipText(UIText.CommitDialogPreferencePage_hardWrapMessageTooltip);
    addField(hardWrap);//from  w ww .j a  v  a 2s  .co m
}