Search in sources :

Example 31 with BooleanFieldEditor

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

the class CreaterepoDeltaPropertyPage method addContents.

@Override
protected Composite addContents(Composite parent) {
    composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    composite.setLayout(layout);
    bfeEnableDeltas = new BooleanFieldEditor(CreaterepoPreferenceConstants.PREF_DELTA_ENABLE, Messages.CreaterepoDeltaPropertyPage_booleanEnableLabel, composite);
    bfeEnableDeltas.setPreferenceStore(Activator.getDefault().getPreferenceStore());
    bfeEnableDeltas.load();
    bfeEnableDeltas.setPropertyChangeListener(this);
    optionsGroup = new Group(composite, SWT.SHADOW_ETCHED_IN);
    layout = new GridLayout(2, false);
    optionsGroup.setLayout(layout);
    optionsGroup.setText(Messages.CreaterepoDeltaPropertyPage_groupLabel);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(optionsGroup);
    // max deltas.
    ifeNumDeltas = new IntegerFieldEditor(CreaterepoPreferenceConstants.PREF_NUM_DELTAS, Messages.CreaterepoDeltaPropertyPage_maxNumberOfDeltas, optionsGroup);
    ifeNumDeltas.setPreferenceStore(preferenceStore);
    ifeNumDeltas.setValidRange(0, Integer.MAX_VALUE);
    ifeNumDeltas.load();
    ifeNumDeltas.setPropertyChangeListener(this);
    ifeNumDeltas.setTextLimit(String.valueOf(Integer.MAX_VALUE).length());
    // max delta size. stored in megabytes for convenience to user
    ifeMaxSizeDeltas = new IntegerFieldEditor(CreaterepoPreferenceConstants.PREF_MAX_DELTA_SIZE, Messages.CreaterepoDeltaPropertyPage_maxDeltaSize, optionsGroup);
    ifeMaxSizeDeltas.setPreferenceStore(preferenceStore);
    ifeMaxSizeDeltas.setValidRange(0, Integer.MAX_VALUE);
    ifeMaxSizeDeltas.load();
    ifeMaxSizeDeltas.setPropertyChangeListener(this);
    ifeMaxSizeDeltas.setTextLimit(String.valueOf(Integer.MAX_VALUE).length());
    // spaces around the group
    layout = (GridLayout) optionsGroup.getLayout();
    layout.marginWidth = 5;
    layout.marginHeight = 5;
    // the group for directories to package against
    dirGroup = new Group(composite, SWT.SHADOW_ETCHED_IN);
    layout = new GridLayout(2, false);
    dirGroup.setLayout(layout);
    dirGroup.setText(Messages.CreaterepoDeltaPropertyPage_groupDirectoryLabel);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(dirGroup);
    peDirectories = new CreaterepoPathEditor(CreaterepoPreferenceConstants.PREF_OLD_PACKAGE_DIRS, Messages.CreaterepoDeltaPropertyPage_directoryDescription, Messages.CreaterepoDeltaPropertyPage_directoryDialogLabel, dirGroup);
    peDirectories.setPreferenceStore(preferenceStore);
    peDirectories.load();
    peDirectories.setPropertyChangeListener(this);
    layout = (GridLayout) dirGroup.getLayout();
    layout.marginWidth = 5;
    layout.marginHeight = 5;
    toggleEnabled();
    return composite;
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) IntegerFieldEditor(org.eclipse.jface.preference.IntegerFieldEditor) BooleanFieldEditor(org.eclipse.jface.preference.BooleanFieldEditor)

Example 32 with BooleanFieldEditor

use of org.eclipse.jface.preference.BooleanFieldEditor 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 33 with BooleanFieldEditor

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

the class WorkflowEditorPreferencePage 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();
    m_emptyNodeLabel = new BooleanFieldEditor(PreferenceConstants.P_SET_NODE_LABEL, "Set node label prefix", parent) {

        /**
         * {@inheritDoc}
         */
        @Override
        protected void valueChanged(final boolean old, final boolean neu) {
            m_nodeLabelPrefix.setEnabled(neu, parent);
        }
    };
    m_nodeLabelPrefix = new StringFieldEditor(PreferenceConstants.P_DEFAULT_NODE_LABEL, "Default node label (prefix): ", parent);
    addField(m_emptyNodeLabel);
    addField(m_nodeLabelPrefix);
    IntegerFieldEditor fontSizeEditor = new IntegerFieldEditor(PreferenceConstants.P_NODE_LABEL_FONT_SIZE, "Change node name and label font size", parent);
    addField(fontSizeEditor);
    addField(new HorizontalLineField(parent));
    addField(new LabelField(parent, "These grid preferences apply to new workflows only."));
    addField(new BooleanFieldEditor(PreferenceConstants.P_GRID_SHOW, "Show grid", parent));
    addField(new BooleanFieldEditor(PreferenceConstants.P_GRID_SNAP_TO, "Snap to grid", parent));
    IntegerFieldEditor gridSizeXEditor = new IntegerFieldEditor(PreferenceConstants.P_GRID_SIZE_X, "Horiz. grid size (in px)", parent);
    gridSizeXEditor.setValidRange(3, 500);
    gridSizeXEditor.setTextLimit(3);
    gridSizeXEditor.load();
    addField(gridSizeXEditor);
    IntegerFieldEditor gridSizeYEditor = new IntegerFieldEditor(PreferenceConstants.P_GRID_SIZE_Y, "Vertic. grid size (in px)", parent);
    gridSizeYEditor.setValidRange(3, 500);
    gridSizeYEditor.setTextLimit(3);
    gridSizeYEditor.load();
    addField(gridSizeYEditor);
    addField(new LabelField(parent, "To change the grid settings of a workflow,\nuse the 'Workflow Editor Settings' " + "toolbar button."));
    addField(new HorizontalLineField(parent));
    addField(new LabelField(parent, "These node connection settings apply to new workflows only."));
    addField(new BooleanFieldEditor(PreferenceConstants.P_CURVED_CONNECTIONS, "Curved connections", parent));
    ComboFieldEditor lineWidthEditor = new ComboFieldEditor(PreferenceConstants.P_CONNECTIONS_LINE_WIDTH, "Node connections line width", new String[][] { { "1", "1" }, { "2", "2" }, { "3", "3" } }, parent);
    lineWidthEditor.load();
    addField(lineWidthEditor);
    addField(new LabelField(parent, "To change the node connection settings of a workflow,\nuse the 'Workflow Editor Settings' " + "toolbar button."));
}
Also used : StringFieldEditor(org.eclipse.jface.preference.StringFieldEditor) 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 34 with BooleanFieldEditor

use of org.eclipse.jface.preference.BooleanFieldEditor 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 35 with BooleanFieldEditor

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

the class CommonPreferencePage method createFieldEditors.

@Override
protected void createFieldEditors() {
    final Composite parent = getFieldEditorParent();
    WorkspaceFileFieldEditor colorEditor = new WorkspaceFileFieldEditor(PreferencesHelper.COLOR_FILE, "Color File: ", new String[] { "def" }, // $NON-NLS-2$
    parent);
    addField(colorEditor);
    WorkspaceFileFieldEditor fontEditor = new WorkspaceFileFieldEditor(PreferencesHelper.FONT_FILE, "Font File: ", new String[] { "def" }, // $NON-NLS-2$
    parent);
    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);
    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);
}
Also used : StringFieldEditor(org.eclipse.jface.preference.StringFieldEditor) Composite(org.eclipse.swt.widgets.Composite) IntegerFieldEditor(org.eclipse.jface.preference.IntegerFieldEditor) 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