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.ge.research.sadl.ui.properties.SadlRootPreferencePage.java

License:Open Source License

@Override
protected void createFieldEditors() {
    addField(new LabelFieldEditor("General SADL Settings", getFieldEditorParent()));
    addField(new StringFieldEditor("baseUri", "Base URI", getFieldEditorParent()));
    addField(new RadioGroupFieldEditor("OWL_Format", "Saved OWL model format :", 5,
            new String[][] {
                    { ConfigurationManager.RDF_XML_ABBREV_FORMAT, ConfigurationManager.RDF_XML_ABBREV_FORMAT },
                    { ConfigurationManager.RDF_XML_FORMAT, ConfigurationManager.RDF_XML_FORMAT },
                    { ConfigurationManager.N3_FORMAT, ConfigurationManager.N3_FORMAT },
                    { ConfigurationManager.N_TRIPLE_FORMAT, ConfigurationManager.N_TRIPLE_FORMAT },
                    { ConfigurationManager.JENA_TDB, ConfigurationManager.JENA_TDB }, },
            getFieldEditorParent()));//from  w w  w .  j  a  v a2s.  com
    addField(new RadioGroupFieldEditor("importBy", "Show import model list as:", 2,
            new String[][] { { "Model Namespaces", "ns" }, { "SADL File Names", "fn" } },
            getFieldEditorParent()));
    addField(new BooleanFieldEditor("prefixesOnlyAsNeeded",
            "Show prefixes for imported concepts only when needed for disambiguation", getFieldEditorParent()));
    addField(new BooleanFieldEditor("validateBeforeTest", "Validate before Testing", getFieldEditorParent()));
    addField(new BooleanFieldEditor("namespacesInQueryResults", "Show Namespaces in Query Results",
            getFieldEditorParent()));
    addField(new BooleanFieldEditor("showTimingInformation", "Show Timing Informaton (Build, Reasoning)",
            getFieldEditorParent()));
    addField(new RadioGroupFieldEditor(IConfigurationManager.dmyOrder, "Interpret Date 10/11/2012 as:", 2,
            new String[][] { { "MM/DD/YYYY", IConfigurationManager.dmyOrderMDY },
                    { "DD/MM/YYYY", IConfigurationManager.dmyOrderDMY } },
            getFieldEditorParent()));
    addField(new BooleanFieldEditor("deepValidationOff", "Disable Deep Validation of Model",
            getFieldEditorParent()));
    addField(new StringFieldEditor("graphvizpath", "GraphViz bin folder", getFieldEditorParent()));
}

From source file:com.ge.research.sadl.ui.properties.TranslatorConfigurationDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);

    editors = new ArrayList<FieldEditor>();
    messageArea = new DialogMessageArea();

    page = new FieldEditorPreferencePage(FieldEditorPreferencePage.GRID) {
        @Override//from   w w  w .j a v  a  2 s . c  om
        public void createControl(Composite parentComposite) {
            noDefaultAndApplyButton();
            super.createControl(parentComposite);
        }

        @SuppressWarnings("synthetic-access")
        @Override
        protected void createFieldEditors() {
            rcps = this.doGetPreferenceStore();
            if (rcps == null) {
                rcps = new PreferenceStore();
            }
            FieldEditor editor;
            if (config == null) {
                messageArea.updateText("No options available", IMessageProvider.NONE);
                return;
            }
            for (Map.Entry<String, ConfigurationOption> entry : config.entrySet()) {
                String key = entry.getKey();
                ConfigurationOption option = entry.getValue();
                if (key.equalsIgnoreCase("builtin")) {
                    continue;
                }
                String optionDescription = option.getDescription();
                Object currentValue = currentConfig.get(key);
                Object optionValue = option.getValue();
                if (currentValue != null) {
                    optionValue = currentValue;
                }
                logger.debug(key + " class = " + optionValue.getClass().getName());
                Object[] optionPossibleValues = option.getPossibleValues();
                if (optionPossibleValues != null && optionPossibleValues.length > 0) {
                    // Option has a list of values so create a dropdown box
                    String[][] nv = new String[optionPossibleValues.length][2];
                    for (int i = 0; i < optionPossibleValues.length; i++) {
                        nv[i][0] = optionPossibleValues[i].toString();
                        nv[i][1] = optionPossibleValues[i].toString();
                    }
                    editor = new ComboFieldEditor(key, optionDescription, nv, getFieldEditorParent());
                    rcps.setValue(editor.getPreferenceName(), optionValue.toString());
                    editor.setPreferenceStore(rcps);
                    addField(editor);
                    editor.load();
                    editors.add(editor);
                } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.String")) {
                    editor = new StringFieldEditor(key, optionDescription, getFieldEditorParent());
                    rcps.setValue(editor.getPreferenceName(), optionValue.toString());
                    editor.setPreferenceStore(rcps);
                    addField(editor);
                    editor.load();
                    editors.add(editor);
                } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.Boolean")) {
                    editor = new BooleanFieldEditor(key, optionDescription, BooleanFieldEditor.SEPARATE_LABEL,
                            getFieldEditorParent());
                    rcps.setValue(editor.getPreferenceName(), optionValue.toString());
                    editor.setPreferenceStore(rcps);
                    addField(editor);
                    editor.load();
                    editors.add(editor);
                } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.Integer")) {
                    editor = new IntegerFieldEditor(key, optionDescription, getFieldEditorParent());
                    rcps.setValue(editor.getPreferenceName(), optionValue.toString());
                    editor.setPreferenceStore(rcps);
                    addField(editor);
                    editor.setPage(page);
                    editor.load();
                    editors.add(editor);
                } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.Double")) {
                    editor = new DoubleFieldEditor(key, optionDescription, getFieldEditorParent());
                    rcps.setValue(editor.getPreferenceName(), optionValue.toString());
                    editor.setPreferenceStore(rcps);
                    addField(editor);
                    editor.load();
                    editors.add(editor);
                }
            }
        }

        @SuppressWarnings("synthetic-access")
        @Override
        protected void updateApplyButton() {
            updateButtons(isValid());
            super.updateApplyButton();
        }

    };

    messageArea.createContents(composite);
    messageArea.showTitle(translatorCategory + " Configuration Options", null);
    messageArea.setMessageLayoutData(new GridData(GridData.FILL_BOTH));
    page.createControl(composite);
    for (FieldEditor editor : editors) {
        editor.setPreferenceStore(rcps);
    }
    Control pageControl = page.getControl();
    pageControl.setLayoutData(new GridData(GridData.FILL_BOTH));
    return pageControl;
}

From source file:com.github.ipaas.ideploy.plugin.ui.preference.CrsPreferencePage.java

License:Apache License

@Override
protected Control createContents(Composite parent) {
    GridLayout gloableLable = new GridLayout();
    gloableLable.numColumns = 2;/*from  w w w.  j a v  a 2s . com*/
    parent.setLayout(gloableLable);

    Group group = new Group(parent, SWT.NONE);
    group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    host = new StringFieldEditor("host", "Ideploy Host:", group);
    account = new StringFieldEditor("email", "Ideploy Account:", group);
    password = new StringFieldEditor("password", "Ideploy Password:", group) {
        @Override
        protected void doFillIntoGrid(Composite parent, int numColumns) {
            super.doFillIntoGrid(parent, numColumns);
            getTextControl().setEchoChar('*');
        }
    };
    new Label(parent, SWT.NONE).setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    new Label(parent, SWT.NONE).setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    new Label(parent, SWT.NONE).setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    // create a table
    table = new Table(parent, SWT.BORDER | SWT.FULL_SELECTION | SWT.CHECK);
    table.setLayoutData(new GridData(GridData.FILL_VERTICAL));

    TableColumn checkCln = new TableColumn(table, SWT.CENTER);
    TableColumn nameCln = new TableColumn(table, SWT.CENTER);
    TableColumn locationCln = new TableColumn(table, SWT.CENTER);
    TableColumn enableCln = new TableColumn(table, SWT.CENTER);
    checkCln.setText("");
    nameCln.setText("Name");
    locationCln.setText("Parnter");
    enableCln.setText("Enable");
    checkCln.setWidth(30);
    nameCln.setWidth(100);
    locationCln.setWidth(150);
    enableCln.setWidth(80);
    table.setHeaderVisible(true);
    table.setLinesVisible(true);

    table.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
            for (int i = 0; i < table.getItemCount(); i++) {
                TableItem item = table.getItem(i);
                item.setText(3, item.getChecked() ? "Enable" : "Disable");
            }
        }
    });

    Group buttonGroup = new Group(parent, SWT.NONE);

    GridData buttonData = new GridData(GridData.FILL_VERTICAL);
    buttonGroup.setLayoutData(buttonData);
    GridLayout buttonLayout = new GridLayout(1, true);
    buttonGroup.setLayout(buttonLayout);

    final Button addBtn = new Button(buttonGroup, SWT.PUSH);
    addBtn.setText("  Add   ");
    addBtn.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            shell.setData("nameText", "");
            shell.setData("patternText", "");
            editDialog.open();
            if (shell.getData("nameText") != null && shell.getData("patternText") != null) {
                addTableItem(true, shell.getData("nameText").toString(),
                        shell.getData("patternText").toString(), table);
            }
        }
    });

    final Button editBtn = new Button(buttonGroup, SWT.PUSH);
    editBtn.setText("  Edit   ");
    editBtn.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            TableItem[] selectItems = table.getSelection();
            if (selectItems.length > 0 && selectItems[0] != null) {
                shell.setData("nameText", selectItems[0].getText(1));
                shell.setData("patternText", selectItems[0].getText(2));
                editDialog.open();
                String name = (String) shell.getData("nameText");
                String pattern = (String) shell.getData("patternText");
                editTableItem(name, pattern, table);
            }

        }
    });

    final Button rmBtn = new Button(buttonGroup, SWT.PUSH);
    rmBtn.setText("Remove");
    rmBtn.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            TableItem[] items = table.getSelection();
            if (items.length >= 0) {
                table.remove(table.getSelectionIndex());
            }
        }
    });
    table.select(0);
    initialize();
    return null;
}

From source file:com.google.devtools.depan.maven.eclipse.preferences.AnalysisPreferencesPage.java

License:Apache License

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

    FileFieldEditor executable = new FileFieldEditor(AnalysisPreferenceIds.MVN_ANALYSIS_EXECUTABLE,
            "Maven Executable", true, parent);
    executable.setEmptyStringAllowed(false);

    BooleanFieldEditor systemjava = new BooleanFieldEditor(AnalysisPreferenceIds.MVN_ANALYSIS_SYSTEMJAVA,
            "Use System JAVA_HOME", BooleanFieldEditor.SEPARATE_LABEL, parent);

    final DirectoryFieldEditor javahome = new DirectoryFieldEditor(AnalysisPreferenceIds.MVN_ANALYSIS_JAVAHOME,
            "JAVA_HOME", parent);

    StringFieldEditor effectivepom = new StringFieldEditor(AnalysisPreferenceIds.MVN_ANALYSIS_EFFECTIVEPOM,
            "Maven Effective POM command", parent);
    effectivepom.setEmptyStringAllowed(false);

    addField(executable);//from w  w w. j  av  a2  s . c o  m
    addField(systemjava);
    addField(javahome);
    addField(effectivepom);
}

From source file:com.gorillalogic.monkeyconsole.preferences.ProxyServerPreferencePage.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./*  ww w.jav  a2s . com*/
 */
public void createFieldEditors() {

    // GENERAL PREFERENCES
    addField(new RadioGroupFieldEditor(PreferenceConstants.P_PROXY_SERVER_TYPE, "Proxy Server Type:", 2,
            new String[][] { { "HTTP", "HTTP" }, { "SOCKS", "SOCKS" } }, getFieldEditorParent()));
    addField(new IntegerFieldEditor(PreferenceConstants.P_PROXY_SERVER_PORT, "Proxy Server Port:",
            getFieldEditorParent()));

    addField(new BooleanFieldEditor(PreferenceConstants.P_RECORD_SERVER_REQUEST, "Record Server Requests",
            getFieldEditorParent()));

    addField(new StringFieldEditor(PreferenceConstants.P_EXTERNAL_PROXY_SERVER_HOST, "External Proxy Host:",
            getFieldEditorParent()));

    addField(new IntegerFieldEditor(PreferenceConstants.P_EXTERNAL_PROXY_SERVER_PORT, "External Proxy Port:",
            getFieldEditorParent()));
    checkState();

}

From source file:com.halware.nakedide.eclipse.core.logging.LogPreferencePage.java

License:Open Source License

@Override
protected void createFieldEditors() {

    addField(new BooleanFieldEditor(LogController.CONSOLE_APPENDER_KEY,
            Activator.getResourceString("LogPreferencePage.ConsoleAppender"), //$NON-NLS-1$
            getFieldEditorParent()));//from  w  ww .ja  va  2  s. c o m

    addField(new BooleanFieldEditor(LogController.SOCKET_APPENDER_KEY,
            Activator.getResourceString("LogPreferencePage.SocketAppender"), //$NON-NLS-1$
            getFieldEditorParent()));

    addField(new StringFieldEditor(LogController.SOCKET_APPENDER_HOST_NAME_KEY,
            Activator.getResourceString("LogPreferencePage.SocketAppenderHostName"), //$NON-NLS-1$
            getFieldEditorParent()));

    addField(new IntegerFieldEditor(LogController.SOCKET_APPENDER_PORT_KEY,
            Activator.getResourceString("LogPreferencePage.SocketAppenderPort"), //$NON-NLS-1$
            getFieldEditorParent()));

    addField(new RadioGroupFieldEditor(LogController.LEVEL_KEY,
            Activator.getResourceString("LogPreferencePage.Level"), //$NON-NLS-1$
            5, new String[][] { { "Debug", "debug" }, { "Info", "info" }, { "Warn", "warn" },
                    { "Error", "error" }, { "Fatal", "fatal" }, },
            getFieldEditorParent(), true));

}

From source file:com.joeygibson.eclipse.junitlaunchfixer.preferences.JUnitLaunchFixerPreferencePage.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  ww  . jav a 2s .c o m*/
public void createFieldEditors() {
    addField(new StringFieldEditor(PreferenceConstants.P_MAX_HEAP, "&Max Heap Size:", getFieldEditorParent()));
    addField(new StringFieldEditor(PreferenceConstants.P_MAX_PERM_SIZE, "Max &Perm Size:",
            getFieldEditorParent()));
    addField(new BooleanFieldEditor(PreferenceConstants.P_UPDATE_EXISTING_LAUNCHERS,
            "&Update Existing Launchers On Next Restart?", getFieldEditorParent()));
}

From source file:com.jstar.eclipse.preferences.JStarPreferencePage.java

License:BSD License

public void createFieldEditors() {
    addField(new FileFieldEditor(PreferenceConstants.JSTAR_PATH, "&jStar executable:", getFieldEditorParent()));
    addField(new DirectoryFieldEditor(PreferenceConstants.JSTAR_LOGIC_LIBRARY_PREFERENCE,
            "&jStar Logic Library:", getFieldEditorParent()));
    addField(new DirectoryFieldEditor(PreferenceConstants.JSTAR_ABS_LIBRARY_PREFERENCE, "&jStar Abs Library:",
            getFieldEditorParent()));/*w w  w.j  a v a 2 s  . com*/
    addField(new DirectoryFieldEditor(PreferenceConstants.JSTAR_SPECS_LIBRARY_PREFERENCE,
            "&jStar Specs Library:", getFieldEditorParent()));

    if (SystemUtils.IS_OS_MAC) {
        addField(new FileFieldEditor(PreferenceConstants.SOOT_CLASSPATH_CLASSES, "&classes.jar:",
                getFieldEditorParent()));
        addField(
                new FileFieldEditor(PreferenceConstants.SOOT_CLASSPATH_UI, "&ui.jar:", getFieldEditorParent()));
    } else {
        addField(
                new FileFieldEditor(PreferenceConstants.SOOT_CLASSPATH_RT, "&rt.jar:", getFieldEditorParent()));
    }

    addField(new FileFieldEditor(PreferenceConstants.SMT_PATH_PREFERENCE, "&smt solver executable:",
            getFieldEditorParent()));
    addField(new StringFieldEditor(PreferenceConstants.SMT_ARGUMENTS_PREFERENCE, "&smt solver arguments:",
            getFieldEditorParent()));

    addField(new BooleanFieldEditor(PreferenceConstants.VERIFY_AFTER_SAVING, "Verify after saving the file",
            getFieldEditorParent()));
}

From source file:com.legstar.eclipse.plugin.cixscom.preferences.AbstractCixsPreferencePage.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 .  ja v a 2 s .com*/
 */
public void createFieldEditors() {

    addField(new StringFieldEditor(PreferenceConstants.DEFAULT_CIXS_PACKAGE_NAME_PREFIX,
            Messages.cixs_package_name_prefix_label + ':', getFieldEditorParent()));

    addField(new StringFieldEditor(PreferenceConstants.DEFAULT_CIXS_TARGET_DIST_FOLDER,
            Messages.cixs_distribution_folder_label + ':', getFieldEditorParent()));

}

From source file:com.legstar.eclipse.plugin.common.preferences.LegStarPreferencePage.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  ww  .  j  a  v  a2 s.c  o m
 */
public void createFieldEditors() {

    addField(new StringFieldEditor(PreferenceConstants.ANT_SCRIPTS_FOLDER,
            Messages.ant_scripts_folder_label + ':', getFieldEditorParent()));

    addField(new StringFieldEditor(PreferenceConstants.HOST_CHARSET, Messages.mainframe_charset_label + ':',
            getFieldEditorParent()));
}