Example usage for org.eclipse.jface.preference ComboFieldEditor getComboBoxControl

List of usage examples for org.eclipse.jface.preference ComboFieldEditor getComboBoxControl

Introduction

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

Prototype

private Combo getComboBoxControl(Composite parent) 

Source Link

Usage

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()));/*w  ww. ja  v a 2  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()));
}