Search in sources :

Example 16 with BooleanFieldEditor

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

the class HeadlessPreferencePage method createFieldEditors.

/**
 * {@inheritDoc}
 */
@Override
protected void createFieldEditors() {
    Composite parent = getFieldEditorParent();
    // Specify the minimum log level for log file
    addField(new RadioGroupFieldEditor(HeadlessPreferencesConstants.P_LOGLEVEL_LOG_FILE, "Log File Log Level", 4, new String[][] { { "&DEBUG", LEVEL.DEBUG.name() }, { "&INFO", LEVEL.INFO.name() }, { "&WARN", LEVEL.WARN.name() }, { "&ERROR", LEVEL.ERROR.name() } }, parent));
    addField(new BooleanFieldEditor(HeadlessPreferencesConstants.P_LOG_FILE_LOCATION, "Enable per workflow logs", parent));
    m_logDirGLobal = new BooleanFieldEditor(HeadlessPreferencesConstants.P_LOG_GLOBAL_IN_WF_DIR, "Log global messages also to workflow log", parent);
    addField(m_logDirGLobal);
    // number threads
    IntegerFieldEditor maxThreadEditor = new IntegerFieldEditor(HeadlessPreferencesConstants.P_MAXIMUM_THREADS, "Maximum working threads for all nodes", parent, 3);
    maxThreadEditor.setValidRange(1, Math.max(100, Runtime.getRuntime().availableProcessors() * 4));
    maxThreadEditor.setTextLimit(3);
    addField(maxThreadEditor);
    // temp dir
    DirectoryFieldEditor tempDirEditor = new TempDirFieldEditor(HeadlessPreferencesConstants.P_TEMP_DIR, "Directory for temporary files\n(you should restart KNIME after" + " changing this value)", parent);
    tempDirEditor.setEmptyStringAllowed(false);
    addField(tempDirEditor);
    addField(new HorizontalLineField(parent));
    addField(new LabelField(parent, "Improve KNIME", SWT.BOLD));
    addField(new LabelField(parent, "Help us improve KNIME by sending anonymous usage data."));
    addField(new LabelField(parent, "Click <a href=\"https://www.knime.com/faq#usage_data\">here</a> to find out what is being transmitted."));
    BooleanFieldEditor sendAnonymousStatisticsEditor = new BooleanFieldEditor(HeadlessPreferencesConstants.P_SEND_ANONYMOUS_STATISTICS, "Yes, help improve KNIME.", parent);
    addField(sendAnonymousStatisticsEditor);
}
Also used : RadioGroupFieldEditor(org.eclipse.jface.preference.RadioGroupFieldEditor) Composite(org.eclipse.swt.widgets.Composite) IntegerFieldEditor(org.eclipse.jface.preference.IntegerFieldEditor) BooleanFieldEditor(org.eclipse.jface.preference.BooleanFieldEditor) DirectoryFieldEditor(org.eclipse.jface.preference.DirectoryFieldEditor)

Example 17 with BooleanFieldEditor

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

the class MainPreferencePage method createFieldEditors.

/**
 * 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.
 */
@Override
public void createFieldEditors() {
    final Composite parent = getFieldEditorParent();
    // Specify the minimum log level for the console
    m_consoleLogEditor = new RadioGroupFieldEditor(KNIMECorePlugin.P_LOGLEVEL_CONSOLE, "Console View Log Level", 4, new String[][] { { "&DEBUG", LEVEL.DEBUG.name() }, { "&INFO", LEVEL.INFO.name() }, { "&WARN", LEVEL.WARN.name() }, { "&ERROR", LEVEL.ERROR.name() } }, parent);
    addField(m_consoleLogEditor);
    addField(new HorizontalLineField(parent));
    addField(new BooleanFieldEditor(PreferenceConstants.P_CONFIRM_RESET, "Confirm Node Reset", parent));
    addField(new BooleanFieldEditor(PreferenceConstants.P_CONFIRM_DELETE, "Confirm Node/Connection Deletion", parent));
    addField(new BooleanFieldEditor(PreferenceConstants.P_CONFIRM_RECONNECT, "Confirm reconnection of already connected nodes", parent));
    addField(new BooleanFieldEditor(PreferenceConstants.P_CONFIRM_EXEC_NODES_NOT_SAVED, "Confirm if executing nodes are not saved", parent));
    addField(new BooleanFieldEditor(PreferenceConstants.P_CONFIRM_LOAD_NIGHTLY_BUILD_WORKFLOW, "Confirm when loading workflows created by a nightly build", parent));
    ComboFieldEditor dataAwareExecutePromptEditor = new ComboFieldEditor(PreferenceConstants.P_EXEC_NODES_DATA_AWARE_DIALOGS, "Execute upstream nodes when needed", new String[][] { { "Always", MessageDialogWithToggle.ALWAYS }, { "Never", MessageDialogWithToggle.NEVER }, { "Prompt", MessageDialogWithToggle.PROMPT } }, getFieldEditorParent());
    addField(dataAwareExecutePromptEditor);
    addField(new HorizontalLineField(parent));
    final BooleanFieldEditor enableAutoSaveBooleanField = new BooleanFieldEditor(PreferenceConstants.P_AUTO_SAVE_ENABLE, "Auto Save open workflows", parent) {

        @Override
        protected void valueChanged(final boolean old, final boolean neu) {
            m_autoSaveIntervalEditor.setEnabled(neu, parent);
            m_autoSaveWithDataEditor.setEnabled(neu, parent);
        }
    };
    m_autoSaveIntervalEditor = new IntegerFieldEditor(PreferenceConstants.P_AUTO_SAVE_INTERVAL, "Auto-Save Interval (in secs)", parent);
    m_autoSaveWithDataEditor = new BooleanFieldEditor(PreferenceConstants.P_AUTO_SAVE_DATA, "Save with data", parent);
    addField(enableAutoSaveBooleanField);
    addField(m_autoSaveIntervalEditor);
    addField(m_autoSaveWithDataEditor);
    addField(new HorizontalLineField(parent));
    addField(new BooleanFieldEditor(PreferenceConstants.P_WRAP_TABLE_HEADER, "Wrap Column Header in Table Views", parent));
    addField(new IntegerFieldEditor(PreferenceConstants.P_ANNOTATION_BORDER_SIZE, "Workflow Annotation border size (in px)", parent));
    addField(new HorizontalLineField(parent));
    ComboFieldEditor updateMetaNodeLinkOnLoadEditor = new ComboFieldEditor(PreferenceConstants.P_META_NODE_LINK_UPDATE_ON_LOAD, "Update metanode links when workflow loads", new String[][] { { "Always", MessageDialogWithToggle.ALWAYS }, { "Never", MessageDialogWithToggle.NEVER }, { "Prompt", MessageDialogWithToggle.PROMPT } }, getFieldEditorParent());
    addField(updateMetaNodeLinkOnLoadEditor);
    addField(new HorizontalLineField(parent));
    addField(new BooleanFieldEditor(PreferenceConstants.P_OMIT_MISSING_BROWSER_WARNING, "Suppress warnings about missing browser integration", parent));
    addField(new HorizontalLineField(parent));
    addField(new LabelField(parent, "Settings for the 'Favorite Nodes' view"));
    IntegerFieldEditor freqHistorySizeEditor = new IntegerFieldEditor(PreferenceConstants.P_FAV_FREQUENCY_HISTORY_SIZE, "Maximal size for most frequently used nodes", parent, 3);
    freqHistorySizeEditor.setValidRange(1, 50);
    freqHistorySizeEditor.setTextLimit(3);
    freqHistorySizeEditor.load();
    IntegerFieldEditor usedHistorySizeEditor = new IntegerFieldEditor(PreferenceConstants.P_FAV_LAST_USED_SIZE, "Maximal size for last used nodes", parent, 3);
    usedHistorySizeEditor.setValidRange(1, 50);
    usedHistorySizeEditor.setTextLimit(3);
    usedHistorySizeEditor.load();
    addField(usedHistorySizeEditor);
    addField(freqHistorySizeEditor);
}
Also used : RadioGroupFieldEditor(org.eclipse.jface.preference.RadioGroupFieldEditor) Composite(org.eclipse.swt.widgets.Composite) IntegerFieldEditor(org.eclipse.jface.preference.IntegerFieldEditor) BooleanFieldEditor(org.eclipse.jface.preference.BooleanFieldEditor) ComboFieldEditor(org.eclipse.jface.preference.ComboFieldEditor)

Example 18 with BooleanFieldEditor

use of org.eclipse.jface.preference.BooleanFieldEditor in project yamcs-studio by yamcs.

the class PreferencePage method createFieldEditors.

@Override
protected void createFieldEditors() {
    Composite parent = getFieldEditorParent();
    nbMessageLineToDisplay = new IntegerFieldEditor(PREF_LINECOUNT, "Number of lines per event message (0: unlimited)", parent);
    addField(nbMessageLineToDisplay);
    Label label = new Label(parent, SWT.NONE);
    label.setText("Columns to be displayed:");
    showColumSeqNum = new BooleanFieldEditor(PREF_SHOW_SEQNUM_COL, "Sequence Number", parent);
    showColumReception = new BooleanFieldEditor(PREF_SHOW_RECTIME_COL, "Reception Time", parent);
    showColumnGeneration = new BooleanFieldEditor(PREF_SHOW_GENTIME_COL, "Generation Time", parent);
    addField(showColumSeqNum);
    addField(showColumReception);
    addField(showColumnGeneration);
}
Also used : Composite(org.eclipse.swt.widgets.Composite) Label(org.eclipse.swt.widgets.Label) IntegerFieldEditor(org.eclipse.jface.preference.IntegerFieldEditor) BooleanFieldEditor(org.eclipse.jface.preference.BooleanFieldEditor)

Example 19 with BooleanFieldEditor

use of org.eclipse.jface.preference.BooleanFieldEditor in project yamcs-studio by yamcs.

the class OPIRuntimePreferencePage method createFieldEditors.

@Override
protected void createFieldEditors() {
    final Composite parent = getFieldEditorParent();
    macrosEditor = new StringTableFieldEditor(PreferencesHelper.RUN_MACROS, "Macros: ", parent, new String[] { "Name", "Value" }, new boolean[] { true, true }, new MacroEditDialog(parent.getShell()), new int[] { 120, 120 }) {

        @Override
        public boolean isValid() {
            String reason;
            for (String[] row : items) {
                reason = Verifier.checkElementName(row[0]);
                if (reason != null) {
                    wrongMacroName = row[0];
                    return false;
                }
            }
            return true;
        }

        @Override
        protected void doStore() {
            if (!isValid())
                return;
            super.doStore();
        }

        @Override
        protected void doFillIntoGrid(Composite parent, int numColumns) {
            super.doFillIntoGrid(parent, numColumns);
            tableEditor.getTableViewer().getTable().addKeyListener(new KeyAdapter() {

                @Override
                public void keyReleased(KeyEvent e) {
                    boolean valid = isValid();
                    fireStateChanged(IS_VALID, !valid, valid);
                }
            });
            tableEditor.getTableViewer().getTable().addFocusListener(new FocusListener() {

                @Override
                public void focusLost(FocusEvent e) {
                    boolean valid = isValid();
                    fireStateChanged(IS_VALID, !valid, valid);
                }

                @Override
                public void focusGained(FocusEvent e) {
                    boolean valid = isValid();
                    fireStateChanged(IS_VALID, !valid, valid);
                }
            });
        }
    };
    addField(macrosEditor);
    IntegerFieldEditor guiRefreshCycleEditor = new IntegerFieldEditor(PreferencesHelper.OPI_GUI_REFRESH_CYCLE, "OPI GUI Refresh Cycle (ms)", parent);
    guiRefreshCycleEditor.setValidRange(10, 5000);
    guiRefreshCycleEditor.getTextControl(parent).setToolTipText("The fastest refresh cycle for OPI GUI in millisecond");
    addField(guiRefreshCycleEditor);
    IntegerFieldEditor pulsingMinorPeriodFieldEditor = new IntegerFieldEditor(PreferencesHelper.PULSING_ALARM_MINOR_PERIOD, "Time period of MINOR alarm if pulsing alarm selected (ms)", parent);
    pulsingMinorPeriodFieldEditor.setValidRange(100, 10000);
    pulsingMinorPeriodFieldEditor.getTextControl(parent).setToolTipText("If the pulsing alarm box is checked for a widget that monitors a PV, " + "then what is the time period of the pulse with the PV is in MINOR alarm severity");
    addField(pulsingMinorPeriodFieldEditor);
    IntegerFieldEditor pulsingMajorPeriodFieldEditor = new IntegerFieldEditor(PreferencesHelper.PULSING_ALARM_MAJOR_PERIOD, "Time period of MAJOR alarm if pulsing alarm selected (ms)", parent);
    pulsingMajorPeriodFieldEditor.setValidRange(100, 10000);
    pulsingMajorPeriodFieldEditor.getTextControl(parent).setToolTipText("If the pulsing alarm box is checked for a widget that monitors a PV, " + "then what is the time period of the pulse with the PV is in MAJOR alarm severity");
    addField(pulsingMajorPeriodFieldEditor);
    String[] allPVFactories = SimplePVLayer.getAllPVFactoryExtensions();
    String[][] entries = new String[allPVFactories.length][2];
    for (int i = 0; i < allPVFactories.length; i++) {
        entries[i][0] = allPVFactories[i];
        entries[i][1] = allPVFactories[i];
    }
    ComboFieldEditor pvConnectionLayerEditor = new ComboFieldEditor(PreferencesHelper.PV_CONNECTION_LAYER, "PV Connection Layer", entries, parent);
    addField(pvConnectionLayerEditor);
    ComboFieldEditor popupConsoleEditor = new ComboFieldEditor(PreferencesHelper.POPUP_CONSOLE, "Console Popup Level", new String[][] { { "Error, Warning and Info", ConsolePopupLevel.ALL.toString() }, { "Only Info", ConsolePopupLevel.ONLY_INFO.toString() }, { "Don't Popup", ConsolePopupLevel.NO_POP.toString() } }, parent);
    addField(popupConsoleEditor);
    StringFieldEditor pythonPathEditor = new StringFieldEditor(PreferencesHelper.PYTHON_PATH, "PYTHONPATH", parent);
    pythonPathEditor.getTextControl(parent).setToolTipText("The path to search python modules");
    addField(pythonPathEditor);
    BooleanFieldEditor showCompactModeDialogEditor = new BooleanFieldEditor(PreferencesHelper.SHOW_COMPACT_MODE_DIALOG, "Show tip dialog about how to exit compact mode", parent);
    addField(showCompactModeDialogEditor);
    BooleanFieldEditor showFullScreenDialogEditor = new BooleanFieldEditor(PreferencesHelper.SHOW_FULLSCREEN_DIALOG, "Show tip dialog about how to exit fullscreen", parent);
    addField(showFullScreenDialogEditor);
    BooleanFieldEditor startWindowInCompactEditor = new BooleanFieldEditor(PreferencesHelper.START_WINDOW_IN_COMPACT_MODE, "Start application window in compact mode.", parent);
    addField(startWindowInCompactEditor);
}
Also used : Composite(org.eclipse.swt.widgets.Composite) KeyAdapter(org.eclipse.swt.events.KeyAdapter) BooleanFieldEditor(org.eclipse.jface.preference.BooleanFieldEditor) ComboFieldEditor(org.eclipse.jface.preference.ComboFieldEditor) FocusEvent(org.eclipse.swt.events.FocusEvent) KeyEvent(org.eclipse.swt.events.KeyEvent) StringFieldEditor(org.eclipse.jface.preference.StringFieldEditor) IntegerFieldEditor(org.eclipse.jface.preference.IntegerFieldEditor) FocusListener(org.eclipse.swt.events.FocusListener)

Example 20 with BooleanFieldEditor

use of org.eclipse.jface.preference.BooleanFieldEditor in project KaiZen-OpenAPI-Editor by RepreZen.

the class SwaggerValidationPreferences method createFieldEditors.

@Override
protected void createFieldEditors() {
    // IMPORTANT: FieldEditorPreferencePage does not work very well with complex layouts and nested widgets.
    // Consider switching to com.modelsolv.reprezen.generators.ui.preferences.GroupedFieldEditorPreferencePage from
    // the RepreZen repo before modifying it
    Composite refValidationComposite = new Composite(getFieldEditorParent(), SWT.BORDER);
    GridLayoutFactory.fillDefaults().applyTo(refValidationComposite);
    GridDataFactory.fillDefaults().grab(true, false).indent(0, 10).applyTo(refValidationComposite);
    Label header = new Label(refValidationComposite, SWT.NONE);
    header.setText("Allow JSON references in additional contexts:");
    addField(new BooleanFieldEditor(VALIDATION_REF_SECURITY_DEFINITIONS_OBJECT, "Security Definitions Object", refValidationComposite));
    addField(new BooleanFieldEditor(VALIDATION_REF_SECURITY_SCHEME_OBJECT, "Security Scheme Object", refValidationComposite));
    addField(new BooleanFieldEditor(VALIDATION_REF_SECURITY_REQUIREMENTS_ARRAY, "Security Requirements Array", refValidationComposite));
    addField(new BooleanFieldEditor(VALIDATION_REF_SECURITY_REQUIREMENT_OBJECT, "Security Requirement Object", refValidationComposite));
}
Also used : Composite(org.eclipse.swt.widgets.Composite) Label(org.eclipse.swt.widgets.Label) BooleanFieldEditor(org.eclipse.jface.preference.BooleanFieldEditor)

Aggregations

BooleanFieldEditor (org.eclipse.jface.preference.BooleanFieldEditor)37 Composite (org.eclipse.swt.widgets.Composite)20 IntegerFieldEditor (org.eclipse.jface.preference.IntegerFieldEditor)15 StringFieldEditor (org.eclipse.jface.preference.StringFieldEditor)11 GridData (org.eclipse.swt.layout.GridData)10 Label (org.eclipse.swt.widgets.Label)9 RadioGroupFieldEditor (org.eclipse.jface.preference.RadioGroupFieldEditor)8 Group (org.eclipse.swt.widgets.Group)8 GridLayout (org.eclipse.swt.layout.GridLayout)7 ComboFieldEditor (org.eclipse.jface.preference.ComboFieldEditor)5 Button (org.eclipse.swt.widgets.Button)4 FieldEditor (org.eclipse.jface.preference.FieldEditor)3 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)3 SelectionEvent (org.eclipse.swt.events.SelectionEvent)3 Link (org.eclipse.swt.widgets.Link)3 ColorFieldEditor (org.eclipse.jface.preference.ColorFieldEditor)2 DirectoryFieldEditor (org.eclipse.jface.preference.DirectoryFieldEditor)2 FileFieldEditor (org.eclipse.jface.preference.FileFieldEditor)2 SWT (org.eclipse.swt.SWT)2 SelectionListener (org.eclipse.swt.events.SelectionListener)2