Example usage for org.eclipse.jface.preference StringFieldEditor StringFieldEditor

List of usage examples for org.eclipse.jface.preference StringFieldEditor StringFieldEditor

Introduction

In this page you can find the example usage for org.eclipse.jface.preference StringFieldEditor StringFieldEditor.

Prototype

public StringFieldEditor(String name, String labelText, Composite parent) 

Source Link

Document

Creates a string field editor of unlimited width.

Usage

From source file:net.tourbook.device.daum.ergobike.PrefPageDaumErgoBike.java

License:Open Source License

@Override
protected void createFieldEditors() {

    final Composite parent = getFieldEditorParent();
    GridLayoutFactory.fillDefaults().applyTo(parent);

    /*/*from  www . j ava 2s .c o m*/
     * decimal format
     */
    _groupDecimalFormat = new Group(parent, SWT.NONE);
    _groupDecimalFormat.setText(Messages.pref_regional_title);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(_groupDecimalFormat);
    {
        // check: use custom format
        _chkUseCustomFormat = new BooleanFieldEditor(ITourbookPreferences.REGIONAL_USE_CUSTOM_DECIMAL_FORMAT,
                Messages.pref_regional_useCustomDecimalFormat, _groupDecimalFormat);
        _chkUseCustomFormat.fillIntoGrid(_groupDecimalFormat, 2);
        _chkUseCustomFormat.setPreferenceStore(_prefStore);
        _chkUseCustomFormat.load();
        _chkUseCustomFormat.setPropertyChangeListener(new IPropertyChangeListener() {
            public void propertyChange(final PropertyChangeEvent event) {
                enableControls();
            }
        });

        // text: group separator
        _txtGroupSep = new StringFieldEditor(ITourbookPreferences.REGIONAL_GROUP_SEPARATOR,
                Messages.pref_regional_groupSeparator, _groupDecimalFormat);
        GridDataFactory.swtDefaults().hint(15, SWT.DEFAULT)
                .applyTo(_txtGroupSep.getTextControl(_groupDecimalFormat));
        _txtGroupSep.setTextLimit(1);
        _txtGroupSep.setPreferenceStore(_prefStore);
        _txtGroupSep.load();
        _txtGroupSep.setPropertyChangeListener(new IPropertyChangeListener() {
            public void propertyChange(final PropertyChangeEvent event) {
                setExampleValue();
            }
        });

        // text: decimal separator
        _txtDecimalSep = new StringFieldEditor(ITourbookPreferences.REGIONAL_DECIMAL_SEPARATOR,
                Messages.pref_regional_decimalSeparator, _groupDecimalFormat);
        GridDataFactory.swtDefaults().hint(15, SWT.DEFAULT)
                .applyTo(_txtDecimalSep.getTextControl(_groupDecimalFormat));
        _txtDecimalSep.setTextLimit(1);
        _txtDecimalSep.setPreferenceStore(_prefStore);
        _txtDecimalSep.load();
        _txtDecimalSep.setPropertyChangeListener(new IPropertyChangeListener() {
            public void propertyChange(final PropertyChangeEvent event) {
                setExampleValue();
            }
        });

        // label: value example
        _lblExample = new Label(_groupDecimalFormat, SWT.NONE);
        _lblExample.setText(Messages.pref_regional_value_example);

        _lblExampleValue = new Label(_groupDecimalFormat, SWT.NONE);
        _lblExampleValue.setText(UI.EMPTY_STRING);
    }

    // add layout to the group
    final GridLayout regionalLayout = (GridLayout) _groupDecimalFormat.getLayout();
    regionalLayout.marginWidth = 5;
    regionalLayout.marginHeight = 5;

    enableControls();
    setExampleValue();
}

From source file:net.yatomiya.nicherry.ui.preference.NetworkPage.java

License:Open Source License

@Override
public void createFieldEditors() {
    CompositeField rootField = getRootCompositeField();

    rootField.addField(new StringFieldEditor(NPreferences.NETWORK_HTTP_USER_AGENT,
            "", rootField.getControl()));
    rootField.addField(new SpinnerFieldEditor(NPreferences.BBS_NETWORK_CONNECT_INTERVAL_PER_HOST,
            "BBS?????",
            rootField.getControl(), 0, 1000 * 60, 1, 1000));

    rootField.addField(LabelField.createSeparatorField(rootField.getControl()));

    rootField.addField(new BooleanFieldEditor(NPreferences.NETWORK_PROXY_ENABLE, "?",
            rootField.getControl()) {//from w ww  . jav  a  2s .co  m
        @Override
        protected void valueChanged(boolean oldValue, boolean newValue) {
            updateProxyGroupEnable();
        }
    });
    {
        proxyGroup = new GroupField(this, rootField.getControl(), SWT.NONE, "");
        rootField.addField(proxyGroup);

        proxyGroup.addField(
                new StringFieldEditor(NPreferences.NETWORK_PROXY_HOST, "", proxyGroup.getControl()));
        proxyGroup.addField(
                new IntegerFieldEditor(NPreferences.NETWORK_PROXY_PORT, "?", proxyGroup.getControl()));
        proxyGroup.addField(new StringFieldEditor(NPreferences.NETWORK_PROXY_BASIC_USERNAME,
                "?", proxyGroup.getControl()));
        proxyGroup.addField(new StringFieldEditor(NPreferences.NETWORK_PROXY_BASIC_PASSWORD, "",
                proxyGroup.getControl()));

        proxyGroup.setEnable(Boolean.valueOf(NUtils.getPreference(NPreferences.NETWORK_PROXY_ENABLE)));
    }

}

From source file:net.yatomiya.nicherry.ui.preference.ThreadViewPage.java

License:Open Source License

@Override
public void createFieldEditors() {
    CompositeField rootField = getRootCompositeField();

    rootField.addField(new FontFieldEditor(NPreferences.MESSAGE_VIEWER_FONT_PROPOTIONAL, "",
            " ABC abc", rootField.getControl()));
    /*/*from  w  w w  .j ava 2  s  . c o m*/
            rootField.addField(new FontFieldEditor(
                       NPreferences.MESSAGE_VIEWER_FONT_MONOSPACE,
                       "?",
                       " ABC abc",
                       rootField.getControl()));
    */
    rootField.addField(new ColorFieldEditor(NPreferences.MESSAGE_VIEWER_COLOR_FOREGROUND, "",
            rootField.getControl()));
    rootField.addField(new ColorFieldEditor(NPreferences.MESSAGE_VIEWER_COLOR_BACKGROUND, "",
            rootField.getControl()));

    rootField.addField(LabelField.createSeparatorField(rootField.getControl()));

    rootField.addField(new FontFieldEditor(NPreferences.POST_MESSAGE_PANEL_FONT,
            "??", " ABC abc", rootField.getControl()));
    rootField.addField(new BooleanFieldEditor(NPreferences.THREAD_VIEW_UPDATE_WHEN_OPEN_VIEW,
            "???????", rootField.getControl()));
    rootField.addField(new SpinnerFieldEditor(NPreferences.MESSAGE_VIEWER_HOVER_DELAY_TIME,
            "???????",
            rootField.getControl(), 0, 1000 * 60, 1, 1000));
    rootField.addField(new SpinnerFieldEditor(NPreferences.THREAD_VIEW_POST_PANEL_HEIGHT,
            "????", rootField.getControl(), 1, 4096, 1, 10));
    rootField.addField(new SpinnerFieldEditor(NPreferences.POST_MESSAGE_PANEL_WAIT_TIME,
            "????", rootField.getControl(), 0, 60 * 60, 1, 10));
    rootField.addField(new StringFieldEditor(NPreferences.POST_MESSAGE_PANEL_QUOTE_PREFIX, "",
            rootField.getControl()));
}

From source file:org.amanzi.awe.ui.tree.preferences.AbstractLabelPreferencePage.java

License:Open Source License

@Override
protected void createFieldEditors() {
    editor = new StringFieldEditor(getPreferenceKey(), label, getFieldEditorParent());

    addField(editor);
}

From source file:org.amanzi.neo.loader.ui.preferences.internal.AbstractDatasetSynonymsPreferencePage.java

License:Open Source License

@Override
protected void createFieldEditors() {
    for (Entry<INodeType, List<Synonyms>> entry : SynonymsManager.getInstance().getSynonyms(getDatasetType())
            .entrySet()) {/* ww  w .  j  a  v a  2  s  .c om*/
        INodeType nodeType = entry.getKey();

        Group group = new Group(getFieldEditorParent(), SWT.NONE);
        group.setText(nodeType.getId());

        group.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));

        for (Synonyms synonym : entry.getValue()) {
            StringFieldEditor synonymsEditor = new StringFieldEditor(
                    getSynonymsKey(nodeType, synonym.getPropertyName()), synonym.getPropertyName(), group);
            synonymsEditor.setEmptyStringAllowed(false);

            addField(synonymsEditor);
        }
    }
}

From source file:org.apache.cactus.eclipse.runner.ui.CactusPreferencePage.java

License:Apache License

/**
 * 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./*www.  j  a  v  a 2  s  .  c om*/
 */
public void createFieldEditors() {
    addField(new StringFieldEditor(CactusPreferences.CONTEXT_URL_HOST,
            CactusMessages.getString("CactusPreferencePage.label.host"), getFieldEditorParent()));
    addField(new IntegerFieldEditor(CactusPreferences.CONTEXT_URL_PORT,
            CactusMessages.getString("CactusPreferencePage.label.port"), getFieldEditorParent()));
    addField(new StringFieldEditor(CactusPreferences.CONTEXT_URL_PATH,
            CactusMessages.getString("CactusPreferencePage.label.context"), getFieldEditorParent()));
    addField(new DirectoryFieldEditor(CactusPreferences.TEMP_DIR,
            CactusMessages.getString("CactusPreferencePage.label.temp"), getFieldEditorParent()));
}

From source file:org.apache.cactus.eclipse.runner.ui.ContainersPreferencePage.java

License:Apache License

/**
 * 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.//from www  .j  a v a 2 s .co  m
 */
public void createFieldEditors() {
    Composite parent = getFieldEditorParent();
    for (int i = 0; i < containerIds.length; i++) {
        DirectoryFieldEditor dirEditor = new DirectoryFieldEditor(containerIds[i], containerIds[i], parent);
        dirEditor.getTextControl(parent)
                .setToolTipText(CactusMessages.getString("ContainersPreferencePage.label.container"));
        addField(dirEditor);
    }
    BooleanFieldEditor jetty = new BooleanFieldEditor(CactusPreferences.JETTY,
            CactusMessages.getString("ContainersPreferencePage.label.jetty"), BooleanFieldEditor.SEPARATE_LABEL,
            parent);
    jetty.getLabelControl(parent)
            .setToolTipText(CactusMessages.getString("ContainersPreferencePage.label.jetty.tooltip"));
    addField(jetty);
    StringFieldEditor jettyXML = new StringFieldEditor(CactusPreferences.JETTY_XML,
            CactusMessages.getString("ContainersPreferencePage.label.jettyxml"), parent);
    jettyXML.getTextControl(parent)
            .setToolTipText(CactusMessages.getString("ContainersPreferencePage.label.jettyxml.tooltip"));
    addField(jettyXML);
}

From source file:org.apache.felix.sigil.eclipse.ui.wizard.repository.RepositoryWizardPage.java

License:Apache License

public void createControl(Composite parent) {
    Composite control = new Composite(parent, SWT.NONE);
    setControl(control);//from   w  ww  .  j  ava  2 s  .  co  m

    if (getModel().getType().isDynamic()) {
        nameEditor = new StringFieldEditor("name", "Name:", control);
        nameEditor.setEmptyStringAllowed(false);
        addField(nameEditor);
    }

    createFieldEditors();

    int cols = 0;
    for (FieldEditor e : editors) {
        cols = Math.max(cols, e.getNumberOfControls());
    }

    control.setLayout(new GridLayout(cols, false));

    for (FieldEditor e : editors) {
        if (e instanceof StringFieldEditor) {
            StringFieldEditor sfe = (StringFieldEditor) e;
            sfe.getTextControl(getFieldEditorParent()).addModifyListener(new ModifyListener() {
                public void modifyText(ModifyEvent e) {
                    checkPageComplete();
                }
            });
        }
        e.fillIntoGrid(getFieldEditorParent(), cols);
        e.setPreferenceStore(getStore());
        e.load();
    }

    checkPageComplete();
}

From source file:org.apache.felix.sigil.obr.eclipse.OBRRepositoryWizardPage.java

License:Apache License

@Override
public void createFieldEditors() {
    createField(urlEditor = new StringFieldEditor("url", "URL:", getFieldEditorParent()));
    createField(cacheEditor = new DirectoryFieldEditor("cache", "Cache:", getFieldEditorParent()));
    addField(new BooleanFieldEditor("inmemory", "In Memory:", getFieldEditorParent()));
}

From source file:org.apache.felix.sigil.ui.eclipse.ui.wizard.repository.RepositoryWizardPage.java

License:Apache License

public void createControl(Composite parent) {
    Composite control = new Composite(parent, SWT.NONE);
    setControl(control);/*from www.  j ava2  s .c o  m*/

    if (getModel().getType().isDynamic()) {
        nameEditor = new StringFieldEditor("name", "Name:", control);
        nameEditor.setStringValue(getModel().getName());
        nameEditor.getTextControl(getFieldEditorParent()).addModifyListener(new ModifyListener() {
            public void modifyText(ModifyEvent e) {
                checkPageComplete();
            }
        });
    }

    createFieldEditors();

    int cols = nameEditor == null ? 0 : nameEditor.getNumberOfControls();
    for (FieldEditor e : editors) {
        cols = Math.max(cols, e.getNumberOfControls());
    }

    control.setLayout(new GridLayout(cols, false));

    if (nameEditor != null) {
        nameEditor.fillIntoGrid(getFieldEditorParent(), cols);
    }

    for (FieldEditor e : editors) {
        e.fillIntoGrid(getFieldEditorParent(), cols);
        e.setPreferenceStore(getModel().getPreferences());
        e.load();
    }

    checkPageComplete();
}