Search in sources :

Example 16 with RadioGroupFieldEditor

use of org.eclipse.jface.preference.RadioGroupFieldEditor in project linuxtools by eclipse.

the class CreaterepoPreferencePage method createFieldEditors.

@Override
protected void createFieldEditors() {
    Composite parent = getFieldEditorParent();
    // general group
    Group generalGroup = new Group(parent, SWT.SHADOW_ETCHED_IN);
    generalGroup.setText(Messages.CreaterepoPreferencePage_generalGroupLabel);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(2, 1).applyTo(generalGroup);
    // generate unique metadata filenames
    BooleanFieldEditor bfeIncludeChecksum = new BooleanFieldEditor(CreaterepoPreferenceConstants.PREF_UNIQUE_MD_NAME, Messages.CreaterepoPreferencePage_booleanChecksumName, generalGroup);
    bfeIncludeChecksum.load();
    bfeIncludeChecksum.setPropertyChangeListener(this);
    addField(bfeIncludeChecksum);
    // generate sqlite databases
    BooleanFieldEditor bfeSQLDB = new BooleanFieldEditor(CreaterepoPreferenceConstants.PREF_GENERATE_DB, Messages.CreaterepoPreferencePage_booleanGenerateSQLDB, generalGroup);
    bfeSQLDB.load();
    bfeSQLDB.setPropertyChangeListener(this);
    addField(bfeSQLDB);
    // ignore symlinks for packages
    BooleanFieldEditor bfeIgnoreSymlinks = new BooleanFieldEditor(CreaterepoPreferenceConstants.PREF_IGNORE_SYMLINKS, Messages.CreaterepoPreferencePage_booleanIgnoreSymlinks, generalGroup);
    bfeIgnoreSymlinks.load();
    bfeIgnoreSymlinks.setPropertyChangeListener(this);
    addField(bfeIgnoreSymlinks);
    // output files in pretty xml format
    BooleanFieldEditor bfePrettyXML = new BooleanFieldEditor(CreaterepoPreferenceConstants.PREF_PRETTY_XML, Messages.CreaterepoPreferencePage_booleanPrettyXML, generalGroup);
    bfePrettyXML.load();
    bfePrettyXML.setPropertyChangeListener(this);
    addField(bfePrettyXML);
    // number of workers
    IntegerFieldEditor ifeSpawns = new IntegerFieldEditor(CreaterepoPreferenceConstants.PREF_WORKERS, Messages.CreaterepoPreferencePage_numWorkers, generalGroup);
    // more than 128 is alot. limiting. (createrepo warning)
    ifeSpawns.setValidRange(0, 128);
    ifeSpawns.load();
    addField(ifeSpawns);
    updateGroupSpacing(generalGroup);
    // updates group
    Group updatesGroup = new Group(parent, SWT.SHADOW_ETCHED_IN);
    updatesGroup.setText(Messages.CreaterepoPreferencePage_updateGroupLabel);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(2, 1).hint(10, SWT.DEFAULT).applyTo(updatesGroup);
    // don't generate repo metadata, if their timestamps are newer than its rpms
    BooleanFieldEditor bfeSameFilename = new BooleanFieldEditor(CreaterepoPreferenceConstants.PREF_CHECK_TS, Messages.CreaterepoPreferencePage_booleanCheckTS, updatesGroup);
    bfeSameFilename.load();
    bfeSameFilename.setPropertyChangeListener(this);
    addField(bfeSameFilename);
    // note of caution
    Label lblCheckTs = new Label(updatesGroup, SWT.WRAP);
    lblCheckTs.setText(Messages.CreaterepoPreferencePage_checkTSNote);
    GridData data = new GridData();
    data.widthHint = 130;
    data.horizontalAlignment = SWT.FILL;
    data.grabExcessHorizontalSpace = true;
    data.horizontalIndent = 5;
    lblCheckTs.setLayoutData(data);
    updateGroupSpacing(updatesGroup);
    // changelog group
    Group changelogGroup = new Group(parent, SWT.SHADOW_ETCHED_IN);
    changelogGroup.setText(Messages.CreaterepoPreferencePage_changelogGroupLabel);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(2, 1).hint(10, SWT.DEFAULT).applyTo(changelogGroup);
    // don't generate repo metadata, if their timestamps are newer than its rpms
    IntegerFieldEditor ifeChangelogLimit = new IntegerFieldEditor(CreaterepoPreferenceConstants.PREF_CHANGELOG_LIMIT, Messages.CreaterepoPreferencePage_numChangelogLimit, changelogGroup);
    ifeChangelogLimit.setValidRange(0, Integer.MAX_VALUE);
    ifeChangelogLimit.load();
    ifeChangelogLimit.setPropertyChangeListener(this);
    addField(ifeChangelogLimit);
    updateGroupSpacing(changelogGroup);
    Composite checksumsContainer = new Composite(parent, SWT.NONE);
    checksumsContainer.setLayout(new GridLayout());
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).indent(0, 20).grab(true, false).applyTo(checksumsContainer);
    // available checksums
    RadioGroupFieldEditor rgfeChecksums = new RadioGroupFieldEditor(CreaterepoPreferenceConstants.PREF_CHECKSUM, Messages.CreaterepoPreferencePage_checksumGroupLabel, 1, new String[][] { { ICreaterepoChecksums.SHA1, ICreaterepoChecksums.SHA1 }, { ICreaterepoChecksums.MD5, ICreaterepoChecksums.MD5 }, { ICreaterepoChecksums.SHA256, ICreaterepoChecksums.SHA256 }, { ICreaterepoChecksums.SHA512, ICreaterepoChecksums.SHA512 } }, checksumsContainer, true);
    rgfeChecksums.load();
    rgfeChecksums.setPropertyChangeListener(this);
    addField(rgfeChecksums);
    Composite compressContainer = new Composite(parent, SWT.NONE);
    compressContainer.setLayout(new GridLayout());
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).indent(0, 20).grab(true, false).applyTo(compressContainer);
    // available compression types
    RadioGroupFieldEditor rgfeCompressionTypes = new RadioGroupFieldEditor(CreaterepoPreferenceConstants.PREF_COMPRESSION_TYPE, Messages.CreaterepoPreferencePage_compressionGroupLabel, 1, new String[][] { { ICreaterepoCompressionTypes.COMPAT, ICreaterepoCompressionTypes.COMPAT }, { ICreaterepoCompressionTypes.XZ, ICreaterepoCompressionTypes.XZ }, { ICreaterepoCompressionTypes.GZ, ICreaterepoCompressionTypes.GZ }, { ICreaterepoCompressionTypes.BZ2, ICreaterepoCompressionTypes.BZ2 } }, compressContainer, true);
    rgfeCompressionTypes.load();
    rgfeCompressionTypes.setPropertyChangeListener(this);
    addField(rgfeCompressionTypes);
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) RadioGroupFieldEditor(org.eclipse.jface.preference.RadioGroupFieldEditor) Composite(org.eclipse.swt.widgets.Composite) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) IntegerFieldEditor(org.eclipse.jface.preference.IntegerFieldEditor) BooleanFieldEditor(org.eclipse.jface.preference.BooleanFieldEditor)

Example 17 with RadioGroupFieldEditor

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

the class DataStoragePreferencePage method createFieldEditors.

@Override
protected void createFieldEditors() {
    // maps the table store format human readable name to the fully qualified class name
    String[][] labelsAndText = TableStoreFormatRegistry.getInstance().getTableStoreFormats().stream().map(f -> new String[] { f.getName(), f.getClass().getName() }).toArray(String[][]::new);
    m_editor = new RadioGroupFieldEditor(TableStoreFormatRegistry.PREF_KEY_STORAGE_FORMAT, "KNIME Table Storage Format", 1, labelsAndText, getFieldEditorParent());
    addField(m_editor);
    DefaultScope.INSTANCE.getNode(CORE_BUNDLE_SYMBOLIC_NAME).addPreferenceChangeListener(this);
}
Also used : DefaultScope(org.eclipse.core.runtime.preferences.DefaultScope) IPreferenceChangeListener(org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener) InstanceScope(org.eclipse.core.runtime.preferences.InstanceScope) PreferenceChangeEvent(org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent) IWorkbenchPreferencePage(org.eclipse.ui.IWorkbenchPreferencePage) IWorkbench(org.eclipse.ui.IWorkbench) TableStoreFormatRegistry(org.knime.core.data.container.storage.TableStoreFormatRegistry) RadioGroupFieldEditor(org.eclipse.jface.preference.RadioGroupFieldEditor) ScopedPreferenceStore(org.eclipse.ui.preferences.ScopedPreferenceStore) FieldEditorPreferencePage(org.eclipse.jface.preference.FieldEditorPreferencePage) FrameworkUtil(org.osgi.framework.FrameworkUtil) RadioGroupFieldEditor(org.eclipse.jface.preference.RadioGroupFieldEditor)

Example 18 with RadioGroupFieldEditor

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

the class OPIEditorPreferencePage method createFieldEditors.

@Override
protected void createFieldEditors() {
    final Composite parent = getFieldEditorParent();
    WorkspaceFileFieldEditor schemaOPIEditor = new WorkspaceFileFieldEditor(PreferencesHelper.SCHEMA_OPI, "Schema OPI: ", new String[] { "opi" }, // $NON-NLS-2$
    parent);
    schemaOPIEditor.getTextControl(parent).setToolTipText("The opi file that defines the default widget properties value");
    addField(schemaOPIEditor);
    BooleanFieldEditor autoSaveEditor = new BooleanFieldEditor(PreferencesHelper.AUTOSAVE, "Automatically save file before running.", parent);
    addField(autoSaveEditor);
    RadioGroupFieldEditor perspectiveEditor = new RadioGroupFieldEditor(PreferencesHelper.SWITCH_TO_OPI_EDITOR_PERSPECTIVE, "Switch to OPI Editor perspective when opening opi file?", 3, new String[][] { { "Always", MessageDialogWithToggle.ALWAYS }, { "Never", MessageDialogWithToggle.NEVER }, { "Prompt", MessageDialogWithToggle.PROMPT } }, parent, true);
    addField(perspectiveEditor);
    RadioGroupFieldEditor fontInPixelsEditor = new RadioGroupFieldEditor(PreferencesHelper.FONT_DEFAULT_PIXELS_OR_POINTS, "Default sizing for fonts", 2, new String[][] { { "Points", PreferencesHelper.POINTS }, { "Pixels", PreferencesHelper.PIXELS } }, parent, true);
    addField(fontInPixelsEditor);
}
Also used : RadioGroupFieldEditor(org.eclipse.jface.preference.RadioGroupFieldEditor) Composite(org.eclipse.swt.widgets.Composite) BooleanFieldEditor(org.eclipse.jface.preference.BooleanFieldEditor)

Example 19 with RadioGroupFieldEditor

use of org.eclipse.jface.preference.RadioGroupFieldEditor in project org.csstudio.display.builder by kasemir.

the class PreferencePage method createFieldEditors.

/**
 * {@inheritDoc}
 */
@Override
protected void createFieldEditors() {
    final Composite parent = getFieldEditorParent();
    // Time span: 60 seconds .. 1 month
    final IntegerFieldEditor timespan = new IntegerFieldEditor(Preferences.TIME_SPAN, Messages.PrefPage_TimeRange, parent);
    timespan.setValidRange(60, 60 * 60 * 24 * 30);
    addField(timespan);
    // Scan period: >=0
    final StringFieldEditor scanperiod = new StringFieldEditor(Preferences.SCAN_PERIOD, Messages.PrefPage_ScanPeriod, parent) {

        @Override
        protected boolean checkState() {
            final Text text = getTextControl();
            if (text == null)
                return false;
            try {
                final double period = Double.parseDouble(text.getText().trim());
                if (period < 0) {
                    showErrorMessage(Messages.ScanPeriodTT);
                    return false;
                }
                clearErrorMessage();
                return true;
            } catch (Exception ex) {
                showErrorMessage(Messages.ScanPeriodTT);
                return false;
            }
        }
    };
    addField(scanperiod);
    // Live sample buffer: 0 ... max int
    final IntegerFieldEditor buffersize = new IntegerFieldEditor(Preferences.BUFFER_SIZE, Messages.PrefPage_LiveBufferSize, parent);
    buffersize.setValidRange(0, Integer.MAX_VALUE);
    addField(buffersize);
    // Refresh period: >0 seconds
    final StringFieldEditor updateperiod = new StringFieldEditor(Preferences.UPDATE_PERIOD, Messages.PrefPage_UpdatePeriod, parent) {

        @Override
        protected boolean checkState() {
            final Text text = getTextControl();
            if (text == null)
                return false;
            try {
                final double period = Double.parseDouble(text.getText().trim());
                if (period <= 0) {
                    showErrorMessage(Messages.UpdatePeriodTT);
                    return false;
                }
                clearErrorMessage();
                return true;
            } catch (Exception ex) {
                showErrorMessage(Messages.UpdatePeriodTT);
                return false;
            }
        }
    };
    addField(updateperiod);
    // Line Width: Some pixel range
    final IntegerFieldEditor linewidth = new IntegerFieldEditor(Preferences.LINE_WIDTH, Messages.PrefPage_TraceLineWidth, parent);
    linewidth.setValidRange(0, 100);
    addField(linewidth);
    // Opacity: 0..100%
    final IntegerFieldEditor opacity = new IntegerFieldEditor(Preferences.OPACITY, Messages.PrefPage_TraceOpacity, parent);
    opacity.setValidRange(0, 100);
    addField(opacity);
    // Trace type options
    final TraceType[] trace_values = TraceType.values();
    final String[][] trace_labels_and_values = new String[trace_values.length][2];
    for (int i = 0; i < trace_values.length; ++i) {
        trace_labels_and_values[i][0] = trace_values[i].toString();
        trace_labels_and_values[i][1] = trace_values[i].name();
    }
    final ComboFieldEditor trace_types = new ComboFieldEditor(Preferences.TRACE_TYPE, Messages.TraceTypes_Label, trace_labels_and_values, parent);
    addField(trace_types);
    // Archive fetch delay:  0.1 .. 10 seconds
    final IntegerFieldEditor fetch_delay = new IntegerFieldEditor(Preferences.ARCHIVE_FETCH_DELAY, Messages.PrefPage_ArchiveFetchDelay, parent);
    fetch_delay.setValidRange(100, 10000);
    addField(fetch_delay);
    // Plot bins: 10 ... one bin per second for a year
    final IntegerFieldEditor plotbins = new IntegerFieldEditor(Preferences.PLOT_BINS, Messages.PrefPage_PlotBins, parent);
    plotbins.setValidRange(10, 365 * 24 * 60 * 60);
    addField(plotbins);
    // Future Buffer: 10 ...
    final IntegerFieldEditor scroll_step = new IntegerFieldEditor(Preferences.SCROLL_STEP, Messages.ScrollStepLbl, parent);
    scroll_step.setValidRange(1, (int) Duration.ofDays(1).getSeconds());
    ((Text) scroll_step.getTextControl(parent)).setToolTipText(Messages.ScrollStepTT);
    addField(scroll_step);
    // Archive rescale options
    final ArchiveRescale[] values = ArchiveRescale.values();
    final String[][] labels_and_values = new String[values.length][2];
    for (int i = 0; i < values.length; ++i) {
        labels_and_values[i][0] = values[i].toString();
        labels_and_values[i][1] = values[i].name();
    }
    final RadioGroupFieldEditor rescale = new RadioGroupFieldEditor(Preferences.ARCHIVE_RESCALE, Messages.ArchiveRescale_Label, 1, labels_and_values, parent, false);
    addField(rescale);
    // Server URLs
    final StringTableFieldEditor urls = new StringTableFieldEditor(parent, Preferences.URLS, Messages.PrefPage_DataServerURLs, new String[] { Messages.URL, Messages.ServerAlias }, new boolean[] { true, true }, new int[] { 500, 100 }, new ArchiveURLEditor(parent.getShell()));
    addField(urls);
    // Default archives
    final StringTableFieldEditor archives = new StringTableFieldEditor(parent, Preferences.ARCHIVES, Messages.PrefPage_Archives, new String[] { Messages.ArchiveName, Messages.ArchiveKey, Messages.URL }, new boolean[] { true, true, true }, new int[] { 100, 50, 500 }, new ArchiveDataSourceEditor(parent.getShell()));
    addField(archives);
    addField(new BooleanFieldEditor(Preferences.PROMPT_FOR_ERRORS, Messages.PromptForErrors_Label, parent));
    addField(new BooleanFieldEditor(Preferences.USE_DEFAULT_ARCHIVES, Messages.UseDefaultArchives_Label, parent));
    addField(new BooleanFieldEditor(Preferences.USE_AUTO_SCALE, Messages.UseAutoScale_Label, parent));
    addField(new BooleanFieldEditor(Preferences.AUTOMATIC_HISTORY_REFRESH, Messages.PrefPage_AutomaticHistoryRefresh, parent));
}
Also used : TraceType(org.csstudio.javafx.rtplot.TraceType) Composite(org.eclipse.swt.widgets.Composite) Text(org.eclipse.swt.widgets.Text) BooleanFieldEditor(org.eclipse.jface.preference.BooleanFieldEditor) ComboFieldEditor(org.eclipse.jface.preference.ComboFieldEditor) StringFieldEditor(org.eclipse.jface.preference.StringFieldEditor) RadioGroupFieldEditor(org.eclipse.jface.preference.RadioGroupFieldEditor) ArchiveRescale(org.csstudio.trends.databrowser3.model.ArchiveRescale) IntegerFieldEditor(org.eclipse.jface.preference.IntegerFieldEditor)

Example 20 with RadioGroupFieldEditor

use of org.eclipse.jface.preference.RadioGroupFieldEditor in project liferay-ide by liferay.

the class KaleoUIPreferencePage method createFieldEditors.

@Override
protected void createFieldEditors() {
    String[][] labelAndValues = { { "Always", MessageDialogWithToggle.ALWAYS }, { "Never", MessageDialogWithToggle.NEVER }, { "Prompt", MessageDialogWithToggle.PROMPT } };
    addField(new RadioGroupFieldEditor(KaleoUIPreferenceConstants.EDITOR_PERSPECTIVE_SWITCH, "Open the Kaleo Designer perspective when opening kaleo workflow files.", 3, labelAndValues, getFieldEditorParent(), true));
}
Also used : RadioGroupFieldEditor(org.eclipse.jface.preference.RadioGroupFieldEditor)

Aggregations

RadioGroupFieldEditor (org.eclipse.jface.preference.RadioGroupFieldEditor)23 BooleanFieldEditor (org.eclipse.jface.preference.BooleanFieldEditor)12 Composite (org.eclipse.swt.widgets.Composite)12 IntegerFieldEditor (org.eclipse.jface.preference.IntegerFieldEditor)5 StringFieldEditor (org.eclipse.jface.preference.StringFieldEditor)5 GridLayout (org.eclipse.swt.layout.GridLayout)5 Label (org.eclipse.swt.widgets.Label)4 ComboFieldEditor (org.eclipse.jface.preference.ComboFieldEditor)3 DirectoryFieldEditor (org.eclipse.jface.preference.DirectoryFieldEditor)3 GridData (org.eclipse.swt.layout.GridData)3 Group (org.eclipse.swt.widgets.Group)3 IPropertyChangeListener (org.eclipse.jface.util.IPropertyChangeListener)2 PropertyChangeEvent (org.eclipse.jface.util.PropertyChangeEvent)2 Control (org.eclipse.swt.widgets.Control)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 TraceType (org.csstudio.javafx.rtplot.TraceType)1 ArchiveRescale (org.csstudio.trends.databrowser3.model.ArchiveRescale)1 DefaultScope (org.eclipse.core.runtime.preferences.DefaultScope)1 IPreferenceChangeListener (org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener)1