Search in sources :

Example 96 with BooleanFieldEditor

use of org.eclipse.jface.preference.BooleanFieldEditor in project statecharts by Yakindu.

the class StatechartAppearancePreferencePage method createMiscellaneousEditors.

protected void createMiscellaneousEditors(Composite main) {
    Composite composite = createGroupComposite(main, "Miscellaneous");
    // Syntax coloring:
    BooleanFieldEditor fontScalingEditor = new BooleanFieldEditor(StatechartPreferenceConstants.PREF_FONT_SCALING, "Enable font scaling (Windows)", composite);
    addField(fontScalingEditor);
    if (System.getProperty("os.name").toLowerCase().indexOf("win") == -1) {
        fontScalingEditor.setEnabled(false, composite);
    }
    // Syntax coloring:
    BooleanFieldEditor syntaxColoringEditor = new BooleanFieldEditor(StatechartPreferenceConstants.PREF_SYNTAX_COLORING, "Enable syntax coloring", composite);
    addField(syntaxColoringEditor);
    // Priority labels:
    BooleanFieldEditor priorityLabelsEditor = new BooleanFieldEditor(StatechartPreferenceConstants.PREF_PRIORITY_LABELS, "Show transition and region priority", composite);
    addField(priorityLabelsEditor);
    // Live validation:
    BooleanFieldEditor liveValidationEditor = new BooleanFieldEditor(StatechartPreferenceConstants.PREF_LIVE_VALIDATION, "Enable live validation", composite);
    addField(liveValidationEditor);
}
Also used : Composite(org.eclipse.swt.widgets.Composite) BooleanFieldEditor(org.eclipse.jface.preference.BooleanFieldEditor)

Example 97 with BooleanFieldEditor

use of org.eclipse.jface.preference.BooleanFieldEditor in project tdq-studio-se by Talend.

the class SQLPreferencePage method createFieldEditors.

/*
     * (non-JavaDoc)
     * 
     * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
     */
protected void createFieldEditors() {
    try {
        // Font picker
        fontFieldEditor = new FontFieldEditor(IConstants.FONT, Messages.getString("Text_Font__3"), getFieldEditorParent());
        // MOD by zshen for bug 12046,save the font size.
        fontFieldEditor.setPreferenceStore(getPreferenceStore());
        addField(fontFieldEditor);
        // ~12046
        /*
             * Text Properties group
             */
        Group colorGroup = new Group(getFieldEditorParent(), SWT.NULL);
        colorGroup.setLayout(new GridLayout());
        GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
        gd.horizontalSpan = 3;
        colorGroup.setLayoutData(gd);
        colorGroup.setText(Messages.getString("Text_Properties_6"));
        Composite editorComposite = new Composite(colorGroup, SWT.NONE);
        GridLayout layout = new GridLayout();
        layout.numColumns = 2;
        layout.marginHeight = 0;
        layout.marginWidth = 0;
        editorComposite.setLayout(layout);
        gd = new GridData(GridData.FILL_BOTH);
        editorComposite.setLayoutData(gd);
        final List syntaxColorList = new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
        gd = new GridData(GridData.FILL_BOTH);
        gd.heightHint = convertHeightInCharsToPixels(5);
        syntaxColorList.setLayoutData(gd);
        for (int i = 0; i < highlights.length; i++) syntaxColorList.add(highlights[i].caption);
        Composite stylesComposite = new Composite(editorComposite, SWT.NONE);
        layout = new GridLayout();
        layout.marginHeight = 0;
        layout.marginWidth = 0;
        layout.numColumns = 2;
        stylesComposite.setLayout(layout);
        stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
        Label label = new Label(stylesComposite, SWT.LEFT);
        label.setText(Messages.getString("Color_9"));
        gd = new GridData();
        gd.horizontalAlignment = GridData.BEGINNING;
        label.setLayoutData(gd);
        final ColorEditor syntaxForegroundColorEditor = new ColorEditor(stylesComposite);
        Button foregroundColorButton = syntaxForegroundColorEditor.getButton();
        gd = new GridData(GridData.FILL_HORIZONTAL);
        gd.horizontalAlignment = GridData.BEGINNING;
        foregroundColorButton.setLayoutData(gd);
        foregroundColorButton.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent e) {
                int i = syntaxColorList.getSelectionIndex();
                if (i >= 0) {
                    // text attribute List has been select.
                    PreferenceConverter.setValue(getPreferenceStore(), highlights[i].id, syntaxForegroundColorEditor.getColorValue());
                }
            }
        });
        final Button boldCheckBox = new Button(stylesComposite, SWT.CHECK);
        boldCheckBox.setText(Messages.getString("Bold_10"));
        gd = new GridData(GridData.FILL_HORIZONTAL);
        gd.horizontalAlignment = GridData.BEGINNING;
        gd.horizontalSpan = 2;
        boldCheckBox.setLayoutData(gd);
        boldCheckBox.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent e) {
                int i = syntaxColorList.getSelectionIndex();
                getPreferenceStore().setValue(highlights[i].id + BOLD, boldCheckBox.getSelection());
            }
        });
        syntaxColorList.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent e) {
                int i = syntaxColorList.getSelectionIndex();
                if (i > -1) {
                    boldCheckBox.setSelection(getPreferenceStore().getBoolean(highlights[i].id + BOLD));
                    syntaxForegroundColorEditor.setColorValue(PreferenceConverter.getColor(getPreferenceStore(), highlights[i].id));
                }
            }
        });
        /*
             * Preview group
             */
        Group previewGroup = new Group(getFieldEditorParent(), SWT.NULL);
        previewGroup.setLayout(new GridLayout());
        gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
        gd.horizontalSpan = 3;
        previewGroup.setLayoutData(gd);
        previewGroup.setText(Messages.getString("Preview_7"));
        Control previewer = createPreviewer(previewGroup);
        gd = new GridData(GridData.FILL_BOTH);
        previewer.setLayoutData(gd);
        /*
             * Export To Clipboard group
             */
        Group exportGroup = new Group(getFieldEditorParent(), SWT.NULL);
        exportGroup.setLayout(new GridLayout());
        exportGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
        exportGroup.setText(Messages.getString("Export_to_Clipboard_1"));
        Label lbt1 = new Label(exportGroup, SWT.NULL);
        lbt1.setText("Separator");
        final Button semiColon = new Button(exportGroup, SWT.RADIO);
        semiColon.setText(";");
        final Button pipe = new Button(exportGroup, SWT.RADIO);
        pipe.setText("|");
        final Button tab = new Button(exportGroup, SWT.RADIO);
        tab.setText("\\t [TAB]");
        addAccessor(new Accessor() {

            public void load() {
                String value = getPreferenceStore().getString(IConstants.CLIP_EXPORT_SEPARATOR);
                if (value == null || value.length() < 1)
                    value = ";";
                loadValue(value.charAt(0));
            }

            public void loadDefaults() {
                String value = getPreferenceStore().getDefaultString(IConstants.CLIP_EXPORT_SEPARATOR);
                if (value == null || value.length() < 1)
                    value = ";";
                loadValue(value.charAt(0));
            }

            private void loadValue(char c) {
                semiColon.setSelection(c == ';');
                pipe.setSelection(c == '|');
                tab.setSelection(c == '\t');
            }

            public void store() {
                String separator;
                if (semiColon.getSelection())
                    separator = ";";
                else if (semiColon.getSelection())
                    separator = "|";
                else
                    separator = "\t";
                getPreferenceStore().setValue(IConstants.CLIP_EXPORT_SEPARATOR, separator);
            }
        });
        addField(new BooleanFieldEditor(IConstants.CLIP_EXPORT_COLUMNS, "Export column names", exportGroup));
    } catch (Exception e) {
        SQLExplorerPlugin.error("Could not create SQL preference page", e);
        throw new RuntimeException(e);
    }
}
Also used : Group(org.eclipse.swt.widgets.Group) FontFieldEditor(org.eclipse.jface.preference.FontFieldEditor) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) BooleanFieldEditor(org.eclipse.jface.preference.BooleanFieldEditor) GridLayout(org.eclipse.swt.layout.GridLayout) Control(org.eclipse.swt.widgets.Control) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) List(org.eclipse.swt.widgets.List)

Example 98 with BooleanFieldEditor

use of org.eclipse.jface.preference.BooleanFieldEditor in project convertigo by convertigo.

the class StudioPreferencePage method createContents.

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();
    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();
    cbAutoOpenDefaultConnector = new BooleanFieldEditor(ConvertigoPlugin.PREFERENCE_AUTO_OPEN_DEFAULT_CONNECTOR, "Auto open editor of a default connector", groupGeneral);
    cbAutoOpenDefaultConnector.setPage(this);
    cbAutoOpenDefaultConnector.setPreferenceStore(getPreferenceStore());
    cbAutoOpenDefaultConnector.load();
    cbAutoCreateProjectReference = new BooleanFieldEditor(ConvertigoPlugin.PREFERENCE_AUTO_CREATE_PROJECT_REFERENCE, "Auto create missing project reference", groupGeneral);
    cbAutoCreateProjectReference.setPage(this);
    cbAutoCreateProjectReference.setPreferenceStore(getPreferenceStore());
    cbAutoCreateProjectReference.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();
    localBuildFolder = new StringFieldEditor(ConvertigoPlugin.PREFERENCE_LOCAL_BUILD_FOLDER, "Local Build Folder (where cordova will build applications)", groupLocalBuild);
    localBuildFolder.setPage(this);
    localBuildFolder.setPreferenceStore(getPreferenceStore());
    localBuildFolder.load();
    mobileBuilderThreshold = new StringFieldEditor(ConvertigoPlugin.PREFERENCE_MOBILE_BUILDER_THRESHOLD, "Mobile Builder Threshold (in ms, delay before compilation starts when an application is modified)", groupLocalBuild);
    mobileBuilderThreshold.setPage(this);
    mobileBuilderThreshold.setPreferenceStore(getPreferenceStore());
    mobileBuilderThreshold.load();
    if (mobileBuilderThreshold.getStringValue().isEmpty()) {
        mobileBuilderThreshold.setStringValue(Integer.toString(ConvertigoPlugin.getMobileBuilderThreshold()));
    }
    mobileBuilderThreshold.setEmptyStringAllowed(false);
    BooleanFieldEditor btest = new BooleanFieldEditor("", "", groupLocalBuild);
    btest.getDescriptionControl(groupLocalBuild).setVisible(false);
    return top;
}
Also used : StringFieldEditor(org.eclipse.jface.preference.StringFieldEditor) Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) IntegerFieldEditor(org.eclipse.jface.preference.IntegerFieldEditor) BooleanFieldEditor(org.eclipse.jface.preference.BooleanFieldEditor)

Example 99 with BooleanFieldEditor

use of org.eclipse.jface.preference.BooleanFieldEditor in project knime-workbench by knime.

the class DatabasePreferencePage method createFieldEditors.

@Override
protected void createFieldEditors() {
    final Composite fieldEditorParent = getFieldEditorParent();
    addField(new DatabaseDriverListEditor(P_DATABASE_DRIVERS, "List of loaded database driver files and directories:", fieldEditorParent, this));
    addField(new IntegerFieldEditor(P_DATABASE_TIMEOUT, "Timeout for database operations (in seconds)", fieldEditorParent, 5));
    if (DatabaseConnectionSettings.getSystemPropertyDatabaseTimeout() >= 0) {
        setMessage("Database timeout preference will override system property", IMessageProvider.WARNING);
    }
    addField(new BooleanFieldEditor(P_WORKFLOW_MIGRATION_NOTIFICATION_ENABLED, "Offer the migration of workflows that contain legacy database nodes", fieldEditorParent));
}
Also used : Composite(org.eclipse.swt.widgets.Composite) IntegerFieldEditor(org.eclipse.jface.preference.IntegerFieldEditor) BooleanFieldEditor(org.eclipse.jface.preference.BooleanFieldEditor)

Example 100 with BooleanFieldEditor

use of org.eclipse.jface.preference.BooleanFieldEditor in project knime-workbench by knime.

the class MasterKeyPreferencePage method createFieldEditors.

/**
 * {@inheritDoc}
 */
@Override
protected void createFieldEditors() {
    final Composite parent = getFieldEditorParent();
    m_isMasterKey = new BooleanFieldEditor(HeadlessPreferencesConstants.P_MASTER_KEY_ENABLED, "Enable password en-/decryption", parent) {

        /**
         * {@inheritDoc}
         */
        @Override
        protected void valueChanged(final boolean old, final boolean neu) {
            enableFields(neu);
        }
    };
    m_isMasterKey.load();
    super.addField(m_isMasterKey);
    m_masterKey = new StringFieldEditor("master_key_field", "Master Key: ", 20, parent);
    m_masterKey.getTextControl(parent).setEchoChar('*');
    super.addField(m_masterKey);
    m_masterKeyConfirm = new StringFieldEditor("master_key_field", "Confirm: ", 20, parent);
    m_masterKeyConfirm.getTextControl(parent).setEchoChar('*');
    super.addField(m_masterKeyConfirm);
    m_saveMasterKey = new BooleanFieldEditor(HeadlessPreferencesConstants.P_MASTER_KEY_SAVED, "Save Master Key and don't ask again on restart (unsafe)", parent);
    m_saveMasterKey.load();
    super.addField(m_saveMasterKey);
}
Also used : StringFieldEditor(org.eclipse.jface.preference.StringFieldEditor) Composite(org.eclipse.swt.widgets.Composite) BooleanFieldEditor(org.eclipse.jface.preference.BooleanFieldEditor)

Aggregations

BooleanFieldEditor (org.eclipse.jface.preference.BooleanFieldEditor)222 Composite (org.eclipse.swt.widgets.Composite)99 IntegerFieldEditor (org.eclipse.jface.preference.IntegerFieldEditor)67 StringFieldEditor (org.eclipse.jface.preference.StringFieldEditor)55 GridData (org.eclipse.swt.layout.GridData)52 GridLayout (org.eclipse.swt.layout.GridLayout)40 ComboFieldEditor (org.eclipse.jface.preference.ComboFieldEditor)35 Group (org.eclipse.swt.widgets.Group)32 ColorFieldEditor (org.eclipse.jface.preference.ColorFieldEditor)30 Label (org.eclipse.swt.widgets.Label)30 SelectionEvent (org.eclipse.swt.events.SelectionEvent)29 RadioGroupFieldEditor (org.eclipse.jface.preference.RadioGroupFieldEditor)21 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)20 Button (org.eclipse.swt.widgets.Button)19 SelectionListener (org.eclipse.swt.events.SelectionListener)16 FieldEditor (org.eclipse.jface.preference.FieldEditor)13 FileFieldEditor (org.eclipse.jface.preference.FileFieldEditor)11 LabelFieldEditor (org.python.pydev.shared_ui.field_editors.LabelFieldEditor)11 DirectoryFieldEditor (org.eclipse.jface.preference.DirectoryFieldEditor)10 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)10