Search in sources :

Example 11 with BooleanFieldEditor

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

the class ColorPreferencePage method createFieldEditors.

@Override
protected void createFieldEditors() {
    fbfeUseColors = new BooleanFieldEditor(PREFKEY_COV_USE_COLORS, Messages.ColorPreferencePage_ColorizeCode, this.getFieldEditorParent());
    this.addField(fbfeUseColors);
    fbfeUseGradient = new BooleanFieldEditor(PREFKEY_COV_USE_GRADIENT, Messages.ColorPreferencePage_UseGradient, this.getFieldEditorParent());
    this.addField(fbfeUseGradient);
    fcfeMax = new ColorFieldEditor(PREFKEY_COV_MAX_COLOR, Messages.ColorPreferencePage_BackColorHighest, this.getFieldEditorParent());
    this.addField(fcfeMax);
    fcfeMin = new ColorFieldEditor(PREFKEY_COV_MIN_COLOR, Messages.ColorPreferencePage_BackColorLowest, this.getFieldEditorParent());
    this.addField(fcfeMin);
    fcfeMno = new ColorFieldEditor(PREFKEY_COV_0_COLOR, Messages.ColorPreferencePage_BackColorNotCovered, this.getFieldEditorParent());
    this.addField(fcfeMno);
}
Also used : ColorFieldEditor(org.eclipse.jface.preference.ColorFieldEditor) BooleanFieldEditor(org.eclipse.jface.preference.BooleanFieldEditor)

Example 12 with BooleanFieldEditor

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

the class GraphPreferencePage method createFieldEditors.

@Override
public void createFieldEditors() {
    addField(new BooleanFieldEditor(GraphingPreferenceConstants.P_SHOW_X_GRID_LINES, // $NON-NLS-1$
    Localization.getString("GraphPreferencePage.ShowXGridLines"), getFieldEditorParent()));
    addField(new BooleanFieldEditor(GraphingPreferenceConstants.P_SHOW_Y_GRID_LINES, // $NON-NLS-1$
    Localization.getString("GraphPreferencePage.ShowYGridLines"), getFieldEditorParent()));
    addField(new IntegerFieldEditor(GraphingPreferenceConstants.P_VIEWABLE_DATA_ITEMS, // $NON-NLS-1$
    Localization.getString("GraphPreferencePage.ViewableDataItems"), getFieldEditorParent()));
    addField(new IntegerFieldEditor(GraphingPreferenceConstants.P_X_SERIES_TICKS, // $NON-NLS-1$
    Localization.getString("GraphPreferencePage.XSeriesTicks"), getFieldEditorParent()));
    addField(new IntegerFieldEditor(GraphingPreferenceConstants.P_Y_SERIES_TICKS, // $NON-NLS-1$
    Localization.getString("GraphPreferencePage.YSeriesTicks"), getFieldEditorParent()));
}
Also used : IntegerFieldEditor(org.eclipse.jface.preference.IntegerFieldEditor) BooleanFieldEditor(org.eclipse.jface.preference.BooleanFieldEditor)

Example 13 with BooleanFieldEditor

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

the class MainPreferencePage method createFieldEditors.

@Override
public void createFieldEditors() {
    GridData data = new GridData();
    data.horizontalSpan = 2;
    final Composite parent = getFieldEditorParent();
    Link link = new Link(parent, SWT.NONE);
    link.setText(Messages.MainPreferencePage_0);
    link.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> PreferencesUtil.createPreferenceDialogOn(parent.getShell(), e.text, null, null)));
    addField(changelogEntryFormatFieldEditor(parent));
    Label labelLocal = new Label(parent, SWT.NONE);
    labelLocal.setText(Messages.MainPreferencePage_1);
    labelLocal.setLayoutData(data);
    createLocalesCombo(parent);
    addField(new BooleanFieldEditor(PreferenceConstants.P_SPACES_FOR_TABS, Messages.MainPreferencePage_6, parent));
    Composite numEditorComp = new Composite(parent, SWT.NONE);
    IntegerFieldEditor numEditor = new IntegerFieldEditor(PreferenceConstants.P_NBR_OF_SPACES_FOR_TAB, Messages.MainPreferencePage_7, numEditorComp, 1);
    addField(numEditor);
}
Also used : IntegerFieldEditor(org.eclipse.jface.preference.IntegerFieldEditor) Combo(org.eclipse.swt.widgets.Combo) IWorkbenchPreferencePage(org.eclipse.ui.IWorkbenchPreferencePage) PreferencesUtil(org.eclipse.ui.dialogs.PreferencesUtil) RadioGroupFieldEditor(org.eclipse.jface.preference.RadioGroupFieldEditor) FieldEditorPreferencePage(org.eclipse.jface.preference.FieldEditorPreferencePage) BooleanFieldEditor(org.eclipse.jface.preference.BooleanFieldEditor) Activator(org.eclipse.linuxtools.internal.rpm.ui.editor.Activator) Locale(java.util.Locale) Composite(org.eclipse.swt.widgets.Composite) SWT(org.eclipse.swt.SWT) IWorkbench(org.eclipse.ui.IWorkbench) GridData(org.eclipse.swt.layout.GridData) FieldEditor(org.eclipse.jface.preference.FieldEditor) Label(org.eclipse.swt.widgets.Label) Link(org.eclipse.swt.widgets.Link) SelectionListener(org.eclipse.swt.events.SelectionListener) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) IntegerFieldEditor(org.eclipse.jface.preference.IntegerFieldEditor) BooleanFieldEditor(org.eclipse.jface.preference.BooleanFieldEditor) Link(org.eclipse.swt.widgets.Link)

Example 14 with BooleanFieldEditor

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

the class CreaterepoGeneralPropertyPage method addContents.

@Override
protected Composite addContents(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(2, false);
    GridData layoutData = new GridData();
    composite.setLayout(layout);
    // TODO: use BooleanFieldEditor and get it to layout properly
    // with the link (lnWorkspaceSettings)
    btnProjectSettings = new Button(composite, SWT.CHECK);
    btnProjectSettings.addListener(SWT.Selection, event -> toggleEnabled());
    layoutData = new GridData();
    layoutData.horizontalAlignment = GridData.BEGINNING;
    layoutData.horizontalAlignment = GridData.FILL;
    layoutData.grabExcessHorizontalSpace = true;
    btnProjectSettings.setText(Messages.CreaterepoGeneralPropertyPage_projectSettings);
    btnProjectSettings.setLayoutData(layoutData);
    btnProjectSettings.setSelection(Activator.getDefault().getPreferenceStore().getBoolean(CreaterepoPreferenceConstants.PREF_GENERAL_ENABLED));
    btnProjectSettings.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> checkState()));
    lnWorkspaceSettings = new Link(composite, SWT.NONE);
    layoutData = new GridData();
    layoutData.horizontalAlignment = SWT.END;
    lnWorkspaceSettings.setLayoutData(layoutData);
    lnWorkspaceSettings.setText(NLS.bind(linkTags, Messages.CreaterepoGeneralPropertyPage_workspaceSettings));
    lnWorkspaceSettings.setFont(parent.getFont());
    lnWorkspaceSettings.addListener(SWT.Selection, event -> {
        PreferenceDialog preferenceDialog = PreferencesUtil.createPreferenceDialogOn(getShell(), CREATEREPO_PREFERENCE_ID, new String[] { CREATEREPO_PREFERENCE_ID }, null);
        preferenceDialog.open();
    });
    // general group
    generalGroup = new Group(composite, SWT.SHADOW_ETCHED_IN);
    layout = new GridLayout(2, false);
    generalGroup.setLayout(layout);
    generalGroup.setText(Messages.CreaterepoPreferencePage_generalGroupLabel);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(2, 1).applyTo(generalGroup);
    // generate unique metadata filenames
    bfeIncludeChecksum = new BooleanFieldEditor(CreaterepoPreferenceConstants.PREF_UNIQUE_MD_NAME, Messages.CreaterepoPreferencePage_booleanChecksumName, generalGroup);
    bfeIncludeChecksum.fillIntoGrid(generalGroup, 2);
    bfeIncludeChecksum.setPreferenceStore(preferenceStore);
    bfeIncludeChecksum.setPropertyChangeListener(this);
    bfeIncludeChecksum.load();
    // generate sqlite databases
    bfeSQLDB = new BooleanFieldEditor(CreaterepoPreferenceConstants.PREF_GENERATE_DB, Messages.CreaterepoPreferencePage_booleanGenerateSQLDB, generalGroup);
    bfeSQLDB.fillIntoGrid(generalGroup, 2);
    bfeSQLDB.setPreferenceStore(preferenceStore);
    bfeSQLDB.setPropertyChangeListener(this);
    bfeSQLDB.load();
    // ignore symlinks for packages
    bfeIgnoreSymlinks = new BooleanFieldEditor(CreaterepoPreferenceConstants.PREF_IGNORE_SYMLINKS, Messages.CreaterepoPreferencePage_booleanIgnoreSymlinks, generalGroup);
    bfeIgnoreSymlinks.fillIntoGrid(generalGroup, 2);
    bfeIgnoreSymlinks.setPreferenceStore(preferenceStore);
    bfeIgnoreSymlinks.setPropertyChangeListener(this);
    bfeIgnoreSymlinks.load();
    // output files in pretty xml format
    bfePrettyXML = new BooleanFieldEditor(CreaterepoPreferenceConstants.PREF_PRETTY_XML, Messages.CreaterepoPreferencePage_booleanPrettyXML, generalGroup);
    bfePrettyXML.fillIntoGrid(generalGroup, 2);
    bfePrettyXML.setPreferenceStore(preferenceStore);
    bfePrettyXML.setPropertyChangeListener(this);
    bfePrettyXML.load();
    // number of workers
    ifeSpawns = new IntegerFieldEditor(CreaterepoPreferenceConstants.PREF_WORKERS, Messages.CreaterepoPreferencePage_numWorkers, generalGroup);
    ifeSpawns.fillIntoGrid(generalGroup, 2);
    // more than 128 is alot. limiting. (createrepo warning)
    ifeSpawns.setValidRange(0, 128);
    ifeSpawns.setPreferenceStore(preferenceStore);
    ifeSpawns.setPropertyChangeListener(this);
    ifeSpawns.load();
    updateGroupSpacing(generalGroup);
    // updates group
    updatesGroup = new Group(composite, 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
    bfeSameFilename = new BooleanFieldEditor(CreaterepoPreferenceConstants.PREF_CHECK_TS, Messages.CreaterepoPreferencePage_booleanCheckTS, updatesGroup);
    bfeSameFilename.fillIntoGrid(updatesGroup, 2);
    bfeSameFilename.setPreferenceStore(preferenceStore);
    bfeSameFilename.setPropertyChangeListener(this);
    bfeSameFilename.load();
    // note of caution
    lblCheckTs = new Label(updatesGroup, SWT.WRAP);
    lblCheckTs.setText(Messages.CreaterepoPreferencePage_checkTSNote);
    layoutData = new GridData();
    layoutData.widthHint = 130;
    layoutData.horizontalAlignment = SWT.FILL;
    layoutData.grabExcessHorizontalSpace = true;
    layoutData.horizontalIndent = 5;
    lblCheckTs.setLayoutData(layoutData);
    updateGroupSpacing(updatesGroup);
    // changelog group
    changelogGroup = new Group(composite, 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
    ifeChangelogLimit = new IntegerFieldEditor(CreaterepoPreferenceConstants.PREF_CHANGELOG_LIMIT, Messages.CreaterepoPreferencePage_numChangelogLimit, changelogGroup);
    ifeChangelogLimit.fillIntoGrid(changelogGroup, 2);
    ifeChangelogLimit.setValidRange(0, Integer.MAX_VALUE);
    ifeChangelogLimit.setPreferenceStore(preferenceStore);
    ifeChangelogLimit.setPropertyChangeListener(this);
    ifeChangelogLimit.load();
    updateGroupSpacing(changelogGroup);
    checksumsContainer = new Composite(composite, SWT.NONE);
    checksumsContainer.setLayout(new GridLayout());
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).indent(0, 20).grab(true, false).applyTo(checksumsContainer);
    // available checksums
    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.setPreferenceStore(preferenceStore);
    rgfeChecksums.setPropertyChangeListener(this);
    rgfeChecksums.load();
    compressContainer = new Composite(composite, SWT.NONE);
    compressContainer.setLayout(new GridLayout());
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).indent(0, 20).grab(true, false).applyTo(compressContainer);
    // available compression types
    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.setPreferenceStore(preferenceStore);
    rgfeCompressionTypes.setPropertyChangeListener(this);
    rgfeCompressionTypes.load();
    toggleEnabled();
    return composite;
}
Also used : IntegerFieldEditor(org.eclipse.jface.preference.IntegerFieldEditor) Button(org.eclipse.swt.widgets.Button) NLS(org.eclipse.osgi.util.NLS) GridDataFactory(org.eclipse.jface.layout.GridDataFactory) PreferencesUtil(org.eclipse.ui.dialogs.PreferencesUtil) PreferenceDialog(org.eclipse.jface.preference.PreferenceDialog) RadioGroupFieldEditor(org.eclipse.jface.preference.RadioGroupFieldEditor) Group(org.eclipse.swt.widgets.Group) BooleanFieldEditor(org.eclipse.jface.preference.BooleanFieldEditor) ICreaterepoChecksums(org.eclipse.linuxtools.internal.rpm.createrepo.ICreaterepoChecksums) Messages(org.eclipse.linuxtools.internal.rpm.createrepo.Messages) CreaterepoPreferenceConstants(org.eclipse.linuxtools.internal.rpm.createrepo.CreaterepoPreferenceConstants) Composite(org.eclipse.swt.widgets.Composite) SWT(org.eclipse.swt.SWT) GridData(org.eclipse.swt.layout.GridData) Activator(org.eclipse.linuxtools.internal.rpm.createrepo.Activator) Label(org.eclipse.swt.widgets.Label) Link(org.eclipse.swt.widgets.Link) ICreaterepoCompressionTypes(org.eclipse.linuxtools.internal.rpm.createrepo.ICreaterepoCompressionTypes) Control(org.eclipse.swt.widgets.Control) SelectionListener(org.eclipse.swt.events.SelectionListener) GridLayout(org.eclipse.swt.layout.GridLayout) Group(org.eclipse.swt.widgets.Group) Composite(org.eclipse.swt.widgets.Composite) Label(org.eclipse.swt.widgets.Label) BooleanFieldEditor(org.eclipse.jface.preference.BooleanFieldEditor) GridLayout(org.eclipse.swt.layout.GridLayout) RadioGroupFieldEditor(org.eclipse.jface.preference.RadioGroupFieldEditor) PreferenceDialog(org.eclipse.jface.preference.PreferenceDialog) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) IntegerFieldEditor(org.eclipse.jface.preference.IntegerFieldEditor) Link(org.eclipse.swt.widgets.Link)

Example 15 with BooleanFieldEditor

use of org.eclipse.jface.preference.BooleanFieldEditor in project knime-core 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)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