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:com.liferay.ide.xml.search.ui.XMLSearchPreferencePage.java

License:Open Source License

@Override
protected void createFieldEditors() {
    final Label label = new Label(getFieldEditorParent(), SWT.NONE);
    label.setData(new GridData(SWT.LEFT, SWT.DEFAULT, true, false, 2, 1));
    label.setText("Specify the list of projects to ignore while searching xml files");

    addField(new StringFieldEditor(LiferayXMLSearchUI.PREF_KEY_IGNORE_PROJECTS_LIST, "",
            getFieldEditorParent()));/*from   w  w  w.  j av a 2 s .co  m*/
}

From source file:com.mind_era.knime_rapidminer.knime.nodes.preferences.SubPreferencePage.java

License:Open Source 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  w  w w  .  j  a  v  a  2  s . c  o  m*/
@Override
public void createFieldEditors() {
    for (final String parameterKey : ParameterService.getParameterKeys()) {
        final ParameterType type = ParameterService.getParameterType(parameterKey);
        final String value = ParameterService.getParameterValue(parameterKey);
        final String key = PreferenceInitializer.getRapidminerPreferenceKey(parameterKey);
        if (type instanceof ParameterTypeInt) {
            final ParameterTypeInt intType = (ParameterTypeInt) type;
            final IntegerFieldEditor integerFieldEditor = new IntegerFieldEditor(key, intType.getDescription(),
                    getFieldEditorParent());
            integerFieldEditor.setValidRange(intType.getMinValueInt(), intType.getMaxValueInt());
            integerFieldEditor.setStringValue(value);
            addField(integerFieldEditor);
        } else if (type instanceof ParameterTypeDouble) {
            final ParameterTypeDouble doubleType = (ParameterTypeDouble) type;
            final StringFieldEditor stringFieldEditor = new StringFieldEditor(key, doubleType.getDescription(),
                    getFieldEditorParent());
            addField(stringFieldEditor);
        } else if (type instanceof ParameterTypeStringCategory) {
            final ParameterTypeStringCategory catType = (ParameterTypeStringCategory) type;
            final String[] vals = catType.getValues();
            final String[][] labelAndValues = new String[vals.length][2];
            for (int i = labelAndValues.length; i-- > 0;) {
                labelAndValues[i][0] = vals[i];
                labelAndValues[i][1] = Integer.toString(i);
            }
            final RadioGroupFieldEditor stringFieldEditor = new RadioGroupFieldEditor(key,
                    catType.getDescription(), 2, labelAndValues, getFieldEditorParent(), true);
            addField(stringFieldEditor);
        } else if (type instanceof ParameterTypeFile) {
            final ParameterTypeFile fileType = (ParameterTypeFile) type;
            final FileFieldEditor fileFieldEditor = new FileFieldEditor(key, fileType.getDescription(),
                    getFieldEditorParent());
            addField(fileFieldEditor);
        } else if (type instanceof ParameterTypeDirectory) {
            final ParameterTypeDirectory dirType = (ParameterTypeDirectory) type;
            final DirectoryFieldEditor directoryFieldEditor = new DirectoryFieldEditor(key,
                    dirType.getDescription(), getFieldEditorParent());
            addField(directoryFieldEditor);
        } else if (type instanceof ParameterTypeBoolean) {
            final ParameterTypeBoolean boolType = (ParameterTypeBoolean) type;
            final BooleanFieldEditor booleanFieldEditor = new BooleanFieldEditor(key, boolType.getDescription(),
                    getFieldEditorParent());
            addField(booleanFieldEditor);
        } else if (type instanceof ParameterTypeColor) {
            final ParameterTypeColor colorType = (ParameterTypeColor) type;
            final ColorFieldEditor colorFieldEditor = new ColorFieldEditor(key, colorType.getDescription(),
                    getFieldEditorParent());
            addField(colorFieldEditor);
        } else if (type instanceof ParameterTypeChar) {
            final ParameterTypeChar charType = (ParameterTypeChar) type;
            final StringFieldEditor charFieldEditor = new StringFieldEditor(key, charType.getDescription(), 1,
                    getFieldEditorParent());
            addField(charFieldEditor);
        } else if (type != null)/* if (type instanceof ParameterTypeString) */ {
            // final ParameterTypeString stringType = (ParameterTypeString)
            // type;
            final StringFieldEditor stringFieldEditor = new StringFieldEditor(key, type.getDescription(),
                    StringFieldEditor.UNLIMITED, StringFieldEditor.VALIDATE_ON_FOCUS_LOST,
                    getFieldEditorParent());
            addField(stringFieldEditor);
        } // else Password should be important
    }
    // addField(new DirectoryFieldEditor(PreferenceConstants.P_PATH,
    // "&Directory preference:", getFieldEditorParent()));
    // addField(new BooleanFieldEditor(PreferenceConstants.P_BOOLEAN,
    // "&An example of a boolean preference", getFieldEditorParent()));
    //
    // addField(new RadioGroupFieldEditor(PreferenceConstants.P_CHOICE,
    // "An example of a multiple-choice preference", 1,
    // new String[][] { { "&Choice 1", "choice1" },
    // { "C&hoice 2", "choice2" } }, getFieldEditorParent()));
    // addField(new StringFieldEditor(PreferenceConstants.P_STRING,
    // "A &text preference:", getFieldEditorParent()));
}

From source file:com.mountainminds.eclemma.internal.ui.dialogs.CoveragePreferencePage.java

License:Open Source License

private void createDefaultScopeGroup(final Composite parent) {
    FieldEditor editor;//from   w ww  . jav  a  2s. co m
    final Group group = createGroup(parent, UIMessages.CoveragePreferencesDefaultScope_title);
    editor = new BooleanFieldEditor(UIPreferences.PREF_DEFAULT_SCOPE_SOURCE_FOLDERS_ONLY,
            UIMessages.CoveragePreferencesSourceFoldersOnly_label, group);
    addField(editor);
    editor.fillIntoGrid(group, 2);
    editor = new BooleanFieldEditor(UIPreferences.PREF_DEFAULT_SCOPE_SAME_PROJECT_ONLY,
            UIMessages.CoveragePreferencesSameProjectOnly_label, group);
    addField(editor);
    editor.fillIntoGrid(group, 2);
    editor = new StringFieldEditor(UIPreferences.PREF_DEFAULT_SCOPE_FILTER,
            UIMessages.CoveragePreferencesClasspathFilter_label, group);
    addField(editor);
    editor.fillIntoGrid(group, 2);
    adjustGroupLayout(group);
}

From source file:com.mountainminds.eclemma.internal.ui.dialogs.CoveragePreferencePage.java

License:Open Source License

private void createCoverageRuntimeGroup(final Composite parent) {
    FieldEditor editor;//from  w w  w  . j av a2  s. c o m
    final Group group = createGroup(parent, UIMessages.CoveragePreferencesCoverageRuntime_title);
    editor = new StringFieldEditor(UIPreferences.PREF_AGENT_INCLUDES,
            UIMessages.CoveragePreferencesIncludes_label, group);
    addField(editor);
    editor.fillIntoGrid(group, 2);
    editor = new StringFieldEditor(UIPreferences.PREF_AGENT_EXCLUDES,
            UIMessages.CoveragePreferencesExcludes_label, group);
    addField(editor);
    editor.fillIntoGrid(group, 2);
    editor = new StringFieldEditor(UIPreferences.PREF_AGENT_EXCLCLASSLOADER,
            UIMessages.CoveragePreferencesExcludeClassloaders_label, group);
    addField(editor);
    editor.fillIntoGrid(group, 2);
    Label hint = new Label(group, SWT.WRAP);
    GridDataFactory.fillDefaults().span(2, 1).applyTo(hint);
    hint.setText(UIMessages.CoveragePreferencesCoverageRuntime_message);
    adjustGroupLayout(group);
}

From source file:com.nextep.designer.sqlclient.ui.preferences.SQLClientPreferencePage.java

License:Open Source 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   ww w  .  j av  a2  s .  c o  m*/
 */
public void createFieldEditors() {
    // addField(new DirectoryFieldEditor(PreferenceConstants.P_PATH, "&Directory preference:",
    // getFieldEditorParent()));
    // addField(new BooleanFieldEditor(PreferenceConstants.P_BOOLEAN,
    // "&An example of a boolean preference", getFieldEditorParent()));
    //
    // addField(new RadioGroupFieldEditor(PreferenceConstants.P_CHOICE,
    // "An example of a multiple-choice preference", 1, new String[][] {
    // { "&Choice 1", "choice1" }, { "C&hoice 2", "choice2" } },
    // getFieldEditorParent()));
    // addField(new StringFieldEditor(PreferenceConstants.P_STRING, "A &text preference:",
    // getFieldEditorParent()));
    addField(new DateFormatFieldEditor(PreferenceConstants.EXPORT_DATE_FORMAT, "Date format : ",
            getFieldEditorParent()));
    final StringFieldEditor decimalEditor = new StringFieldEditor(PreferenceConstants.EXPORT_DECIMAL_SEPARATOR,
            "Decimal separator : ", getFieldEditorParent());
    decimalEditor.setTextLimit(1);
    addField(decimalEditor);
    final StringFieldEditor enclosedEditor = new StringFieldEditor(PreferenceConstants.EXPORT_ENCLOSER,
            "Field enclosed by : ", getFieldEditorParent());
    enclosedEditor.setTextLimit(1);
    addField(enclosedEditor);
    final StringFieldEditor escapeEditor = new StringFieldEditor(PreferenceConstants.EXPORT_ESCAPER,
            "Escape character:", getFieldEditorParent());
    escapeEditor.setTextLimit(1);
    addField(escapeEditor);

    addField(new StringFieldEditor(PreferenceConstants.EXPORT_NULL_VALUE, "Null value : ",
            getFieldEditorParent()));
    addField(new StringFieldEditor(PreferenceConstants.EXPORT_SEPARATOR, "Field separator : ",
            getFieldEditorParent()));

}

From source file:com.nitorcreations.robotframework.eclipseide.preferences.TableNamingPreferencePage.java

License:Apache License

@Override
public void createFieldEditors() {
    addField(new StringFieldEditor(PreferenceConstants.P_VARIABLE_TABLE_FORMAT, "&Variable table:",
            getFieldEditorParent()));//from  w  ww  . ja v  a2s .  co m
    addField(new StringFieldEditor(PreferenceConstants.P_SETTING_TABLE_FORMAT, "&Setting/Metadata table:",
            getFieldEditorParent()));
    addField(new StringFieldEditor(PreferenceConstants.P_TESTCASE_TABLE_FORMAT, "&Testcase table:",
            getFieldEditorParent()));
    addField(new StringFieldEditor(PreferenceConstants.P_KEYWORD_TABLE_FORMAT, "User &keyword table:",
            getFieldEditorParent()));
}

From source file:com.nokia.testfw.codegen.ui.preferences.TESTFWPropertiesPreferencePage.java

License:Open Source License

@Override
protected void createFieldEditors() {

    iTestFolderName = new StringFieldEditor(PreferenceConstants.TEST_FOLDER_NAME,
            Messages.getString("TESTFWPropertiesPreferencePage.TestFolder.Name"), getFieldEditorParent()) {
        protected boolean doCheckState() {
            String testFolderName = getTextControl().getText();
            if (!testFolderName.matches("[\\w]*")) {
                setErrorMessage(Messages.getString("TESTFWPropertiesPreferencePage.TestFolder.Error"));
                return false;
            }/*from   w w  w.java 2 s  . co m*/
            return true;
        }
    };

    iUID3MaxValue = new HexFieldEditor(PreferenceConstants.UID3_MAX_VALUE,
            Messages.getString("TESTFWPropertiesPreferencePage.UID3.MaxValue"), getFieldEditorParent()) {
        protected boolean doCheckState() {
            if (super.doCheckState()) {
                if (iUID3MaxValue.getIntValue() < iUID3MinValue.getIntValue()) {
                    setErrorMessage(Messages.getString("TESTFWPropertiesPreferencePage.UID3.Error1"));
                    return false;
                } else {
                    return true;
                }
            } else {
                Messages.getString("TESTFWPropertiesPreferencePage.UIDHexError",
                        iUID3MaxValue.getStringValue());
                return false;
            }
        }
    };

    iUID3MinValue = new HexFieldEditor(PreferenceConstants.UID3_MIN_VALUE,
            Messages.getString("TESTFWPropertiesPreferencePage.UID3.MinValue"), getFieldEditorParent()) {
        protected boolean doCheckState() {
            if (super.doCheckState()) {
                if (iUID3MinValue.getIntValue() > iUID3MaxValue.getIntValue()) {
                    setErrorMessage(Messages.getString("TESTFWPropertiesPreferencePage.UID3.Error2"));
                    return false;
                } else {
                    return true;
                }
            } else {
                Messages.getString("TESTFWPropertiesPreferencePage.UIDHexError",
                        iUID3MinValue.getStringValue());
                return false;
            }
        }
    };

    iAutherName = new StringFieldEditor(PreferenceConstants.AUTHER,
            Messages.getString("TESTFWPropertiesPreferencePage.Author"), getFieldEditorParent());

    iTestFolderName.setEmptyStringAllowed(false);
    iUID3MaxValue.setEmptyStringAllowed(false);
    iUID3MinValue.setEmptyStringAllowed(false);
    iAutherName.setEmptyStringAllowed(true);

    addField(iTestFolderName);
    addField(iUID3MaxValue);
    addField(iUID3MinValue);
    addField(iAutherName);
}

From source file:com.nokia.tools.carbidect.cone.ui.internal.preferences.CommonPropertiesPreferencePage.java

License:Open Source 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 w w  w .j a  v a  2  s.  c o  m
 */
public void createFieldEditors() {
    addField(new StringFieldEditor(PreferenceConstants.OUTPUT_FOLDER, "&Output folder name:",
            getFieldEditorParent()));
    addField(new StringFieldEditor(PreferenceConstants.LAYER_FILTER, "Included &Layers (e.g. -1,-2):",
            getFieldEditorParent()));
    addField(new StringFieldEditor(PreferenceConstants.IMPLML_FILTER, "&Impls filter (e.g. crml):",
            getFieldEditorParent()));
}

From source file:com.photon.phresco.ui.preferences.PhrescoPreferencePage.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./*  w  w  w .j  av  a 2  s  . c  o  m*/
 */
public void createFieldEditors() {
    Composite serviceComposite = new Composite(getFieldEditorParent(), NONE);
    GridLayout layout = new GridLayout(1, false);
    serviceComposite.setLayout(layout);
    StringFieldEditor serviceURL = new StringFieldEditor(PreferenceConstants.SERVICE_URL,
            Messages.PhrescoPreferencePage_service_url, serviceComposite);
    addField(serviceURL);
    serviceURL.setEnabled(false, serviceComposite);
    new Label(serviceComposite, SWT.None).setText(Messages.PhrescoPreferencePage_username_label);
    userTxt = new Text(serviceComposite, SWT.BORDER);
    userTxt.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    userTxt.setText(username);
    new Label(serviceComposite, SWT.None).setText(Messages.PhrescoPreferencePage_password_label);
    pwdTxt = new Text(serviceComposite, SWT.BORDER | SWT.PASSWORD);
    pwdTxt.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    pwdTxt.setText(password);
    new Label(serviceComposite, SWT.None).setText("");
    testBtn = new Button(serviceComposite, SWT.PUSH);
    testBtn.setText(Messages.PhrescoPreferencePage_testbutton_name);
    testBtn.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 2;
    serviceComposite.setLayoutData(data);
    StringFieldEditor jenkinsURL = new StringFieldEditor(PreferenceConstants.JENKINS_URL,
            Messages.PhrescoPreferencePage_ci_url, getFieldEditorParent());
    addField(jenkinsURL);
}

From source file:com.prodyna.bamboo.status.preferences.BambooPreferencePage.java

License:Open Source 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./*  w  ww  . j av  a  2 s  .c  o  m*/
 */
public void createFieldEditors() {

    StringFieldEditor host = new StringFieldEditor(PreferenceConstants.P_BAMBOO_BASE_URL, "Bamboo Host:",
            getFieldEditorParent());
    StringFieldEditor username = new StringFieldEditor(PreferenceConstants.P_BAMBOO_USERNAME, "Benutzername:",
            getFieldEditorParent());
    StringFieldEditor password = new StringFieldEditor(PreferenceConstants.P_BAMBOO_PASSWORD, "Passwort:",
            getFieldEditorParent());

    host.setEmptyStringAllowed(false);
    username.setEmptyStringAllowed(false);
    password.setEmptyStringAllowed(false);
    password.getTextControl(getFieldEditorParent()).setEchoChar('*');

    addField(host);
    addField(username);
    addField(password);
    addField(new ProjectFieldEditor(PreferenceConstants.P_BAMBOO_PROJECTS, "Status relevant Projects:",
            getFieldEditorParent(), host, username, password));
    addField(new StringFieldEditor(PreferenceConstants.P_BAMBOO_EXCLUDE_PLANS, "Exclude Plans (,):",
            getFieldEditorParent()));
}