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

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

Introduction

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

Prototype

public Text getTextControl(Composite parent) 

Source Link

Document

Returns this field editor's text control.

Usage

From source file:eu.hydrologis.jgrass.geonotes.preferences.pages.GeonotesPreferencePage.java

License:Open Source License

public void createFieldEditors() {
    addField(new StringFieldEditor(PreferenceConstants.SMTP_SERVER, PreferenceConstants.SMTP_SERVER,
            getFieldEditorParent()));/*from  ww w  . j  a v  a  2  s  . co m*/
    addField(new StringFieldEditor(PreferenceConstants.SMTP_PORT, PreferenceConstants.SMTP_PORT,
            getFieldEditorParent()));
    addField(new StringFieldEditor(PreferenceConstants.SMTP_USERNAME, PreferenceConstants.SMTP_USERNAME,
            getFieldEditorParent()));
    StringFieldEditor pasField = new StringFieldEditor(PreferenceConstants.SMTP_PASSWORD,
            PreferenceConstants.SMTP_PASSWORD, getFieldEditorParent());
    pasField.getTextControl(getFieldEditorParent()).setEchoChar('*');
    addField(pasField);
    addField(new StringFieldEditor(PreferenceConstants.GEONOTES_DESTINATION_ADDRESS,
            PreferenceConstants.GEONOTES_DESTINATION_ADDRESS, getFieldEditorParent()));
    addField(new BooleanFieldEditor(PreferenceConstants.SMTP_AUTH, PreferenceConstants.SMTP_AUTH,
            getFieldEditorParent()));
}

From source file:net.mldonkey.g2gui.view.pref.G2GuiPref.java

License:Open Source License

protected void createFieldEditors() {

    Composite composite = getFieldEditorParent();
    StringFieldEditor hostNameField = new StringFieldEditor("hostname", "Hostname", composite);

    hostNameField.setPreferenceStore(this.getPreferenceStore());
    hostNameField.fillIntoGrid(composite, 2);
    addField(hostNameField);/*from   w ww  .j a v a 2  s. c o m*/
    hostNameField.load();

    StringFieldEditor portField = new StringFieldEditor("port", "Port", composite);
    portField.setPreferenceStore(this.getPreferenceStore());
    portField.fillIntoGrid(composite, 2);
    addField(portField);
    portField.load();

    StringFieldEditor userNameField = new StringFieldEditor("username", "Username", composite);
    userNameField.setPreferenceStore(this.getPreferenceStore());
    userNameField.fillIntoGrid(composite, 2);
    addField(userNameField);
    userNameField.load();

    StringFieldEditor passwordField = new StringFieldEditor("password", "Password", composite);
    passwordField.getTextControl(composite).setEchoChar('*');
    passwordField.fillIntoGrid(composite, 2);
    passwordField.setPreferenceStore(this.getPreferenceStore());
    addField(passwordField);
    passwordField.load();

    GCJFileFieldEditor executableField = new GCJFileFieldEditor("coreExecutable",
            G2GuiResources.getString("PREF_CORE_EXEC"), true, composite);
    executableField.setPreferenceStore(this.getPreferenceStore());
    addField(executableField);
    executableField.load();

    if (VersionCheck.isWin32()) {
        executableField.setFileExtensions(new String[] { "*.exe;*.bat" });
    } else {
        executableField.setFileExtensions(new String[] { "*" });
    }

    FieldEditor mulitpleInstancesEditor = new BooleanFieldEditor("allowMultipleInstances",
            G2GuiResources.getString("PREF_ALLOW_MULIPLE"), composite);
    mulitpleInstancesEditor.setPreferenceStore(this.getPreferenceStore());
    mulitpleInstancesEditor.fillIntoGrid(composite, 2);
    addField(mulitpleInstancesEditor);
    mulitpleInstancesEditor.load();

    ExtendedBooleanFieldEditor advancedModeEditor = new ExtendedBooleanFieldEditor("advancedMode",
            "Advanced user mode (*)", composite);
    advancedModeEditor.setPreferenceStore(this.getPreferenceStore());
    advancedModeEditor.fillIntoGrid(composite, 2);

    addField(advancedModeEditor);
    advancedModeEditor.load();

    // Make this a little more obvious
    Button b = advancedModeEditor.getChangeControl(composite);
    b.setFont(JFaceResources.getBannerFont());
    b.setToolTipText(G2GuiResources.getString("PREF_ADVANCED_TOOLTIP"));
    b.setForeground(composite.getDisplay().getSystemColor(SWT.COLOR_BLUE));

    ((GridLayout) composite.getLayout()).numColumns = 2;
}

From source file:net.openchrom.xxd.processor.supplier.rscripting.ui.preferences.RServePrefs.java

License:Open Source License

public void createFieldEditors() {

    addField(new SpacerFieldEditor(getFieldEditorParent()));
    addField(new DirectoryFieldEditor(PreferenceConstants.P_TEMP_R, "Path to temporary R Folder",
            getFieldEditorParent()));//from ww  w  .  ja v a2  s . c o m
    addField(new BooleanFieldEditor("RSERVE_NATIVE_START", "Start Rserve in native R", getFieldEditorParent()));
    addField(new BooleanFieldEditor("RSERVE_AUTOSTART",
            "Start Rserve automatically after Plugin start (Not available in native mode connection!)",
            getFieldEditorParent()));
    addField(new BooleanFieldEditor(PreferenceConstants.P_BOOLEAN, "Install path at startup",
            getFieldEditorParent()));
    addField(new BooleanFieldEditor(PreferenceConstants.R_START_SHELL, "Start with shell",
            getFieldEditorParent()));
    selectLinuxShell = new RadioGroupFieldEditor("LINUX_SHELL", "Select Shell (Linux, Mac):", 2,
            new String[][] { { "xterm (Linux, Mac)", "XTERM" }, { "Gnome (Linux)", "GNOME" } },
            getFieldEditorParent(), false);
    addField(selectLinuxShell);
    // addField(new SpacerFieldEditor(getFieldEditorParent()));
    addField(new StringFieldEditor("RSERVE_ARGS", "Rserve startup arguments", getFieldEditorParent()));
    addField(new MultiLineTextFieldEditor("R_STARTUP_ARGS", "R startup commands", -1,
            StringFieldEditor.VALIDATE_ON_KEY_STROKE, getFieldEditorParent()));
    addField(new SpacerFieldEditor(getFieldEditorParent()));
    /*
     * addField(new LabelFieldEditor("Plot:", getFieldEditorParent()));
     * addField(new BooleanFieldEditor("USE_CUSTOM_DEVICE", "Use Custom Device", BooleanFieldEditor.DEFAULT, getFieldEditorParent()));
     * selectionDevice=new RadioGroupFieldEditor("PLOT_DEVICE_SELECTION", "Select Device:\nPlease use action \"Apply \" to see changes and after using action \"Restore Defaults\".\nValues in the Device Definition can be changed and will be stored!", 3, new String[][] { { "Image Default", "PLOT_IMAGE" },{ "Image Cairo", "PLOT_CAIRO" },{ "Image Print", "PLOT_PRINT" }, { "PDF", "PLOT_PDF" },{ "SVG", "PLOT_SVG" },{ "PostScript", "PLOT_POSTSCRIPT" } }, getFieldEditorParent(), false);
     * addField(selectionDevice);
     * //addField(new StringFieldEditor("DEVICE_DEFINITION", "Device Definiton", -1, StringFieldEditor.VALIDATE_ON_KEY_STROKE, getFieldEditorParent()));
     * mult=new MultiLineTextFieldEditor("DEVICE_DEFINITION", "Device Definiton", -1, StringFieldEditor.VALIDATE_ON_KEY_STROKE, getFieldEditorParent());
     * addField(mult);
     * deviceFilename=new StringFieldEditor("DEVICE_FILENAME", "Filename", -1, StringFieldEditor.VALIDATE_ON_KEY_STROKE, getFieldEditorParent());
     * addField(deviceFilename);
     * deviceFilename.setEnabled(false, getFieldEditorParent());
     * selectPDFReader=new RadioGroupFieldEditor("PDF_READER", "PDF Reader (Linux):", 4, new String[][] { { "Acrobat", "ACROBAT" },{ "Evince", "EVINCE" },{ "Kpdf", "KPDF" },{ "Xpdf", "XPDF" } }, getFieldEditorParent(), false);
     * addField(selectPDFReader);
     * addField(new SpacerFieldEditor(getFieldEditorParent()));
     */
    addField(new LabelFieldEditor("Packages:", getFieldEditorParent()));
    PackageServer = new StringFieldEditor(PreferenceConstants.PACKAGE_R_SERVER, "Package Server",
            getFieldEditorParent());
    PackageServer.setErrorMessage("Please enter a valid address!");
    PackageServer.setEmptyStringAllowed(false);
    PackageServer.setStringValue("http://cran.r-project.org");
    addField(PackageServer);
    {
        Composite fieldEditorParent = getFieldEditorParent();
        final ComboFieldEditor comboFieldEditor = new ComboFieldEditor("Server", "Select Server",
                new String[][] { new String[] { "", "" } }, fieldEditorParent);
        final Combo combo = comboFieldEditor.getComboBoxControl(fieldEditorParent);
        combo.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(final SelectionEvent e) {

                PackageServer.setStringValue(webAdresses[combo.getSelectionIndex()]);
            }
        });
        combo.setItems(new String[] { "Argentina", "Australia", "Austria", "Belgium", "Brazil (PR)",
                "Brazil (RJ)", "Brazil (SP 1)", "Brazil (SP 2)", "Canada (BC)", "Canada (ON)",
                "Chile (Santiago)", "Croatia", "Czech Republic", "Denmark", "France (Toulouse)",
                "France (Paris)", "Germany (Goettingen)", "Germany (Muenchen)", "India", "Ireland",
                "Italy (Milano)", "Italy (Padua)", "Italy (Palermo)", "Japan (Aizu)", "Japan (Tokyo)",
                "Japan (Tsukuba)", "Korea", "Mexico", "Netherlands (Amsterdam 2)", "Netherlands (Amsterdam)",
                "Netherlands (Utrecht)", "New Zealand", "Norway", "Poland (Oswiecim)", "Poland (Wroclaw)",
                "Portugal", "Slovenia (Ljubljana)", "South Africa", "Spain (Madrid)", "Sweden",
                "Switzerland (Zuerich)", "Switzerland (Bern)", "Taiwan (Taichung)", "Taiwan (Taipeh)",
                "Thailand", "UK (Bristol)", "USA (CA 1)", "USA (CA 3)", "USA (IA)", "USA (MI)", "USA (MO)",
                "USA (NC)", "USA (PA 2)", "USA (PA)", "USA (WA)" });
        combo.select(1);
        addField(comboFieldEditor);
    }
    {
        addField(new DirectoryFieldEditor("InstallLocation", "Package install location",
                getFieldEditorParent()));
        addField(new SpacerFieldEditor(getFieldEditorParent()));
        addField(new LabelFieldEditor("Rserve Remote:", getFieldEditorParent()));
        addField(new BooleanFieldEditor("REMOTE", "Remote enabled", getFieldEditorParent()));
        addField(new StringFieldEditor("HOST", "Host name/IP", getFieldEditorParent()));
        addField(new IntegerFieldEditor("TCP", "TCP port", getFieldEditorParent()));
        addField(new StringFieldEditor("USERNAME", "Username", getFieldEditorParent()));
        StringFieldEditor sf = new StringFieldEditor("PASSWORD", "Password", getFieldEditorParent());
        sf.getTextControl(getFieldEditorParent()).setEchoChar('*');
        addField(sf);
    }
    addField(new SpacerFieldEditor(getFieldEditorParent()));
    {
        addField(new LabelFieldEditor("Transfer to Table options:", getFieldEditorParent()));
        addField(new BooleanFieldEditor("TRANSFER_METHOD",
                "Transfer with \"format\" to Table (default is method \"as.character\")",
                getFieldEditorParent()));
        final IntegerFieldEditor integerFieldEditor = new IntegerFieldEditor("DEFAULT_DIGITS", "Digits",
                getFieldEditorParent());
        // integerFieldEditor.setErrorMessage("Please select an integer value!");
        integerFieldEditor.setValidRange(1, 100);
        addField(integerFieldEditor);
    }
    addField(new SpacerFieldEditor(getFieldEditorParent()));
    {
        addField(new LabelFieldEditor("Sweave/TeX options:", getFieldEditorParent()));
        addField(new DirectoryFieldEditor("SweaveScriptLocation", "Sweave File Location",
                getFieldEditorParent()));
        addField(new DirectoryFieldEditor("pdfLatex", "pdflatex Path", getFieldEditorParent()));
    }
    addField(new SpacerFieldEditor(getFieldEditorParent()));
}

From source file:net.sourceforge.veditor.preference.TopPreferencePage.java

License:Open Source License

private void addCommandField(final String name, final String label) {
    final StringFieldEditor comp = new StringFieldEditor(name, label, getFieldEditorParent());
    addField(comp);/*ww  w.  j  ava  2s  .  c o m*/

    final Button button = new Button(getFieldEditorParent(), SWT.NONE);
    button.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent e) {
            final StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(
                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
            dialog.open();
            final String var = dialog.getVariableExpression();
            comp.getTextControl(getFieldEditorParent()).insert(var);
        }
    });
    button.setText("Variables...");
    GridData data = new GridData();
    data.horizontalSpan = 2;
    data.horizontalAlignment = SWT.END;
    button.setLayoutData(data);
}

From source file:net.tourbook.common.UI.java

License:Open Source License

public static GridData setFieldWidth(final Composite parent, final StringFieldEditor field, final int width) {
    final GridData gd = new GridData();
    gd.widthHint = width;//w w w .  j  a  v a2  s  .  c o m
    field.getTextControl(parent).setLayoutData(gd);
    return gd;
}

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  w  w  w  .j av  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 . jav a2 s.  c  o 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

private void createField(StringFieldEditor editor) {
    editor.getTextControl(getFieldEditorParent()).addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            checkPageComplete();//from  ww w . j ava2s  .c o m
        }
    });
    addField(editor);
}

From source file:org.bonitasoft.studio.engine.preferences.BonitaUserXpPreferencePage.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 2s  . c  o  m*/
@Override
public void createFieldEditors() {

    createTitleBar(Messages.BonitaPreferenceDialog_UserXP_Settings,
            Pics.getImage(PicsConstants.preferenceLogin), false);

    host = new StringFieldEditor(BonitaPreferenceConstants.CONSOLE_HOST, Messages.consolePreferenceHostLabel,
            getFieldEditorParent());
    addField(host);

    port = new IntegerFieldEditor(BonitaPreferenceConstants.CONSOLE_PORT, Messages.consolePreferencePortLabel,
            getFieldEditorParent());
    addField(port);

    Group loginGroup = new Group(getFieldEditorParent(), SWT.NONE);
    loginGroup.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(15, 15).create());
    loginGroup.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).span(2, 1).create());
    loginGroup.setText(Messages.loginAs);

    StringFieldEditor user = new StringFieldEditor(BonitaPreferenceConstants.USER_NAME, Messages.userNameLLabel,
            loginGroup);
    addField(user);
    user.getTextControl(loginGroup)
            .setLayoutData(GridDataFactory.fillDefaults().grab(true, false).indent(0, 15).create());
    user.getLabelControl(loginGroup)
            .setLayoutData(GridDataFactory.fillDefaults().grab(false, false).indent(0, 15).create());

    final PasswordFieldEditor password = new PasswordFieldEditor(BonitaPreferenceConstants.USER_PASSWORD,
            Messages.userPasswordLabel, loginGroup);
    addField(password);

    defaultTheme = new ComboFieldEditor(BonitaPreferenceConstants.DEFAULT_USERXP_THEME,
            Messages.bind(Messages.defaultUserXPThemeLabel, new Object[] { bonitaPortalModuleName }),
            getAvailableThemes(), getFieldEditorParent());
    addField(defaultTheme);

}

From source file:org.csstudio.opibuilder.preferences.CommonPreferencePage.java

License:Open Source License

@Override
protected void createFieldEditors() {
    final Composite parent = getFieldEditorParent();

    WorkspaceFileFieldEditor colorEditor = new WorkspaceFileFieldEditor(PreferencesHelper.COLOR_FILE,
            "Color File: ", new String[] { "def" }, parent);//$NON-NLS-2$
    addField(colorEditor);//from   w ww .j  ava  2s .c  om

    WorkspaceFileFieldEditor fontEditor = new WorkspaceFileFieldEditor(PreferencesHelper.FONT_FILE,
            "Font File: ", new String[] { "def" }, parent);//$NON-NLS-2$
    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);

    StringFieldEditor topOPIsEditor = new StringFieldEditor(PreferencesHelper.TOP_OPIS, "Top OPIs", parent);
    topOPIsEditor.getTextControl(parent).setToolTipText("The OPIs appeared in top opi button on toolbar");
    addField(topOPIsEditor);

    WorkspaceFileFieldEditor probeOPIEditor = new WorkspaceFileFieldEditor(PreferencesHelper.PROBE_OPI,
            "Probe OPI: ", new String[] { "opi" }, parent);//$NON-NLS-2$
    probeOPIEditor.getTextControl(parent)
            .setToolTipText("The opi file to be invoked from CSS->OPI Probe context menu");
    addField(probeOPIEditor);

    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);

}