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:org.polymap.service.ui.GeneralPreferencePage.java

License:Open Source License

protected void createFieldEditors() {
    Composite fieldParent = getFieldEditorParent();
    StringFieldEditor proxyUrlEditor = new StringFieldEditor(ServicesPlugin.PREF_PROXY_URL,
            Messages.get("GeneralPreferencesPage_proxyUrlLabel"), fieldParent);
    addField(proxyUrlEditor);/*  w w w. j  a va  2 s .  c o m*/
    proxyUrlEditor.getLabelControl(fieldParent)
            .setToolTipText(Messages.get("GeneralPreferencesPage_proxyUrlTip"));
    proxyUrlEditor.getTextControl(fieldParent)
            .setToolTipText(Messages.get("GeneralPreferencesPage_proxyUrlTip"));
}

From source file:org.polymap.service.ui.OwsPropertiesPage.java

License:Open Source License

protected void createFieldEditors() {
    IPreferenceStore store = new PreferenceStore() {
        public boolean needsSaving() {
            return false;
        }/*from ww  w . jav a2s .co  m*/
    };
    setPreferenceStore(store);
    store.setDefault("WMS", providedService.isEnabled());
    store.setDefault("WFS", false);
    store.setDefault(IProvidedService.PROP_PATHSPEC, providedService.getPathSpec());
    store.setDefault(IProvidedService.PROP_SRS, StringUtils.join(providedService.getSRS(), ", "));

    Composite pathParent = getFieldEditorParent();
    Composite uriParent = getFieldEditorParent();

    // URI
    final StringFieldEditor uriField = new StringFieldEditor("URI", "URI*", uriParent);
    addField(uriField);
    uriField.setStringValue(ServicesPlugin.createServiceUrl(providedService.getPathSpec()));
    uriField.getTextControl(uriParent).setToolTipText("The complete URI of this service.");
    uriField.setEnabled(false, uriParent);

    // service path
    StringFieldEditor pathField = new StringFieldEditor(IProvidedService.PROP_PATHSPEC, "Service Name/Pfad",
            pathParent) {

        protected boolean doCheckState() {
            String value = getStringValue();
            uriField.setStringValue(ServicesPlugin.createServiceUrl(value));

            String validName = ServicesPlugin.validPathSpec(value);
            if (!value.equals(validName)) {
                setErrorMessage("Der Name darf nur Buchstaben, Zahlen oder '-', '_', '.' enthalten.");
                return false;
            }
            return true;
        }
    };
    addField(pathField);

    // WMS
    BooleanFieldEditor wmsField = new BooleanFieldEditor("WMS", "WMS aktivieren", getFieldEditorParent());
    addField(wmsField);

    // WFS
    BooleanFieldEditor wfsField = new BooleanFieldEditor("WFS", "WFS aktivieren", getFieldEditorParent());
    //        wfsField.setEnabled( false, getFieldEditorParent() );

    // SRS
    //        Composite parent = getFieldEditorParent();
    //        StringFieldEditor srsField = new StringFieldEditor(
    //                IProvidedService.PROP_SRS, "Koordinatensysteme*", parent );
    //        srsField.getLabelControl( parent )
    //                .setToolTipText( "Komma-separierte Liste mit EPSG-Codes: EPSG:31468, EPSG:4326, ..." );
    //        addField( srsField );

    // load default values
    performDefaults();
}

From source file:org.python.pydev.builder.todo.PyTodoPrefPage.java

License:Open Source License

protected void createFieldEditors() {
    Composite p = getFieldEditorParent();
    addField(new StringFieldEditor(PY_TODO_TAGS, "Todo tags (separated by spaces)", p));
}

From source file:org.python.pydev.debug.newconsole.prefs.InteractiveConsolePrefs.java

License:Open Source License

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

    addField(new ColorFieldEditor(PydevConsoleConstants.CONSOLE_OUTPUT_COLOR, "Stdout color", p));

    addField(new ColorFieldEditor(PydevConsoleConstants.CONSOLE_ERROR_COLOR, "Stderr color", p));

    addField(new ColorFieldEditor(PydevConsoleConstants.CONSOLE_INPUT_COLOR, "Stdin color", p));

    addField(new ColorFieldEditor(PydevConsoleConstants.CONSOLE_PROMPT_COLOR, "Prompt color", p));

    addField(new ColorFieldEditor(PydevConsoleConstants.CONSOLE_BACKGROUND_COLOR, "Background color", p));

    addField(new ColorFieldEditor(PydevConsoleConstants.DEBUG_CONSOLE_BACKGROUND_COLOR,
            "Debug console background color", p));

    addField(new StringFieldEditor(PydevConsoleConstants.INTERACTIVE_CONSOLE_VM_ARGS,
            "Vm Args for jython\n(used only on external\nprocess option):", p));

    addField(new StringFieldEditor(PydevConsoleConstants.INTERACTIVE_CONSOLE_ENCODING,
            "Encoding for interactive console:", p));

    addField(new IntegerFieldEditor(PydevConsoleConstants.INTERACTIVE_CONSOLE_MAXIMUM_CONNECTION_ATTEMPTS,
            "Maximum connection attempts\nfor initial communication:", p));

    addField(new BooleanFieldEditor(PydevConsoleConstants.INTERACTIVE_CONSOLE_FOCUS_ON_CONSOLE_START,
            "Focus console when it's started?", BooleanFieldEditor.SEPARATE_LABEL, p));

    addField(new BooleanFieldEditor(PydevConsoleConstants.INTERACTIVE_CONSOLE_TAB_COMPLETION,
            "Enable tab completion in interactive console?", BooleanFieldEditor.SEPARATE_LABEL, p));

    addField(new IntegerFieldEditor(
            ScriptConsoleUIConstants.INTERACTIVE_CONSOLE_PERSISTENT_HISTORY_MAXIMUM_ENTRIES,
            "Maximum number of lines to\nstore in global history\n(0 for unlimited):", p) {
        // We are trying to set a preference that is in a different store, but logically lives within this UI
        @Override/*www.  j a v  a2 s .  c o m*/
        public IPreferenceStore getPreferenceStore() {
            return InteractiveConsolePlugin.getDefault().getPreferenceStore();
        }
    });

    addField(new BooleanFieldEditor(
            PydevConsoleConstants.INTERACTIVE_CONSOLE_SEND_INITIAL_COMMAND_WHEN_CREATED_FROM_EDITOR,
            "When creating console send\ncurrent selection/editor\ncontents for execution?",
            BooleanFieldEditor.SEPARATE_LABEL, p));

    addField(new BooleanFieldEditor(PydevConsoleConstants.INTERACTIVE_CONSOLE_FOCUS_ON_SEND_COMMAND,
            "Focus console when an evaluate\ncommand is sent from the editor?",
            BooleanFieldEditor.SEPARATE_LABEL, p));

    addField(new BooleanFieldEditor(PydevConsoleConstants.INTERACTIVE_CONSOLE_CONNECT_DEBUG_SESSION,
            "Connect console to a Debug Session?", BooleanFieldEditor.SEPARATE_LABEL, p));

    addField(new ComboFieldEditor(PydevConsoleConstants.INTERACTIVE_CONSOLE_ENABLE_GUI_ON_STARTUP,
            "Enable GUI event loop integration?",
            PydevConsoleConstants.ENTRIES_VALUES_INTERACTIVE_CONSOLE_ENABLE_GUI_ON_STARTUP, p));

}

From source file:org.python.pydev.plugin.preferences.PyCodeFormatterPage.java

License:Open Source License

/**
 * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
 *//* ww w  . java  2s .  c o  m*/
@Override
public void createFieldEditors() {
    Composite p = getFieldEditorParent();
    this.fieldParent = p;

    addField(new LinkFieldEditor("link_saveactions", "Note: view <a>save actions</a> to auto-format on save.",
            p, new SelectionListener() {

                @Override
                public void widgetSelected(SelectionEvent e) {
                    String id = "org.python.pydev.editor.saveactions.PydevSaveActionsPrefPage";
                    IWorkbenchPreferenceContainer workbenchPreferenceContainer = ((IWorkbenchPreferenceContainer) getContainer());
                    workbenchPreferenceContainer.openPage(id, null);
                }

                @Override
                public void widgetDefaultSelected(SelectionEvent e) {
                }
            }));

    formatWithAutoPep8 = createBooleanFieldEditorCustom(FORMAT_WITH_AUTOPEP8,
            "Use autopep8.py for code formatting?", p);
    addField(formatWithAutoPep8);

    autopep8Link = new LinkFieldEditor("link_autopep8_interpreter",
            "Note: the default configured <a>Python Interpreter</a> will be used to execute autopep8.py", p,
            new SelectionListener() {

                @Override
                public void widgetSelected(SelectionEvent e) {
                    String id = "org.python.pydev.ui.pythonpathconf.interpreterPreferencesPagePython";
                    IWorkbenchPreferenceContainer workbenchPreferenceContainer = ((IWorkbenchPreferenceContainer) getContainer());
                    workbenchPreferenceContainer.openPage(id, null);
                }

                @Override
                public void widgetDefaultSelected(SelectionEvent e) {
                }
            });
    addField(autopep8Link);

    autopep8Parameters = new StringFieldEditor(AUTOPEP8_PARAMETERS,
            "Parameters for autopep8 (i.e.: -a for aggressive, --ignore E24)", p);
    addField(autopep8Parameters);

    onlyChangedLines = createBooleanFieldEditorCustom(FORMAT_ONLY_CHANGED_LINES,
            "On save, only apply formatting in changed lines?", p);
    addField(onlyChangedLines);

    spaceAfterComma = createBooleanFieldEditorCustom(USE_SPACE_AFTER_COMMA, "Use space after commas?", p);
    addField(spaceAfterComma);

    spaceForParentesis = createBooleanFieldEditorCustom(USE_SPACE_FOR_PARENTESIS,
            "Use space before and after parenthesis?", p);
    addField(spaceForParentesis);

    assignWithSpaceInsideParentesis = createBooleanFieldEditorCustom(USE_ASSIGN_WITH_PACES_INSIDER_PARENTESIS,
            "Use space before and after assign for keyword arguments?", p);
    addField(assignWithSpaceInsideParentesis);

    operatorsWithSpace = createBooleanFieldEditorCustom(USE_OPERATORS_WITH_SPACE,
            "Use space before and after operators? (+, -, /, *, //, **, etc.)", p);
    addField(operatorsWithSpace);

    rightTrimLines = createBooleanFieldEditorCustom(TRIM_LINES, "Right trim lines?", p);
    addField(rightTrimLines);

    rightTrimMultilineLiterals = createBooleanFieldEditorCustom(TRIM_MULTILINE_LITERALS,
            "Right trim multi-line string literals?", p);
    addField(rightTrimMultilineLiterals);

    addNewLineAtEndOfFile = createBooleanFieldEditorCustom(ADD_NEW_LINE_AT_END_OF_FILE,
            "Add new line at end of file?", p);
    addField(addNewLineAtEndOfFile);

    spacesBeforeComment = new ComboFieldEditor(SPACES_BEFORE_COMMENT, "Spaces before a comment?",
            ENTRIES_AND_VALUES_FOR_SPACES, p);
    addField(spacesBeforeComment);

    spacesInStartComment = new ComboFieldEditor(SPACES_IN_START_COMMENT, "Spaces in comment start?",
            ENTRIES_AND_VALUES_FOR_SPACES2, p);
    addField(spacesInStartComment);

    formatAndStyleRangeHelper = new StyledTextForShowingCodeFactory();
    labelExample = formatAndStyleRangeHelper.createStyledTextForCodePresentation(p);
    GridData layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1);
    labelExample.setLayoutData(layoutData);

    addField(new ScopedPreferencesFieldEditor(p, PydevPlugin.DEFAULT_PYDEV_SCOPE, this));
}

From source file:org.python.pydev.pyunit.preferences.PyunitPrefsPage.java

License:Common Public License

/**
 * Creates the editors/* www .  j  a  v a2s .c o m*/
 */
protected void createFieldEditors() {
    Composite p = getFieldEditorParent();

    RadioGroupFieldEditor verbosityEditor = createVerbosityEditor(p);

    StringFieldEditor filterEditor = new StringFieldEditor(PYUNIT_TEST_FILTER, "Filter (regex)", p);

    String s = "filter examples:\n" + ".* or blank - all tests\n"
            + "_abc.* - any test with method name starting with 'test_abc'. \n"
            + "         matches test_abc, test_abc123, test_abcXXXXXX, etc. \n"
            + "_abc,_123 - comma seperate (no spaces) filter for more values \n" + "\n"
            + "Note: this filters on the method names of all <TestCase>s found\n"
            + "      the string 'test' is automatically prepended to the regex\n";

    addField(verbosityEditor);
    addField(filterEditor);
    addField(new LabelFieldEditor("LabelFieldEditor", s, p));
}

From source file:org.python.pydev.ui.pythonpathconf.IronpythonInterpreterPreferencesPage.java

License:Open Source License

@Override
protected void createFieldEditors() {
    super.createFieldEditors();
    addField(new StringFieldEditor(IInterpreterManager.IRONPYTHON_INTERNAL_SHELL_VM_ARGS,
            "Vm arguments for internal shell", getFieldEditorParent()) {
        @Override//from   w  w  w  .j  a  v a 2  s  .  c  o m
        protected void adjustForNumColumns(int numColumns) {
            GridData gd = (GridData) getTextControl().getLayoutData();
            gd.horizontalSpan = numColumns; //We want it in a separate line!
            gd.grabExcessHorizontalSpace = true;

        }
    });
}

From source file:org.robotframework.ide.eclipse.main.plugin.preferences.ContentAssistPreferencePage.java

License:Apache License

protected void createAutoActivationEditors(final Composite parent) {
    final Group autoActivationGroup = new Group(parent, SWT.NONE);
    autoActivationGroup.setText("Auto activation");
    GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(autoActivationGroup);
    GridLayoutFactory.fillDefaults().applyTo(autoActivationGroup);

    final BooleanFieldEditor autoActivationEnabled = new BooleanFieldEditor(
            RedPreferences.ASSISTANT_AUTO_ACTIVATION_ENABLED, "Auto activation enabled", autoActivationGroup);
    addField(autoActivationEnabled);//w w  w  .j  a v a2  s.  co  m
    final Button button = (Button) autoActivationEnabled.getDescriptionControl(autoActivationGroup);
    GridDataFactory.fillDefaults().indent(5, 10).applyTo(button);
    final boolean isAutoActivationEnabled = RedPlugin.getDefault().getPreferences()
            .isAssistantAutoActivationEnabled();

    final IntegerFieldEditor autoActivationDelay = new IntegerFieldEditor(
            RedPreferences.ASSISTANT_AUTO_ACTIVATION_DELAY, "Auto activation delay (ms)", autoActivationGroup,
            3);
    addField(autoActivationDelay);
    delayTextControl = autoActivationDelay.getTextControl(autoActivationGroup);
    delayTextControl.setEnabled(isAutoActivationEnabled);
    GridDataFactory.fillDefaults().indent(25, 2)
            .applyTo(autoActivationDelay.getLabelControl(autoActivationGroup));

    final StringFieldEditor autoActivationChars = new StringFieldEditor(
            RedPreferences.ASSISTANT_AUTO_ACTIVATION_CHARS, "Auto activation triggers", autoActivationGroup);
    addField(autoActivationChars);
    charsTextControl = autoActivationChars.getTextControl(autoActivationGroup);
    charsTextControl.setEnabled(isAutoActivationEnabled);
    GridDataFactory.fillDefaults().indent(25, 2)
            .applyTo(autoActivationChars.getLabelControl(autoActivationGroup));

    button.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent e) {
            delayTextControl.setEnabled(button.getSelection());
            charsTextControl.setEnabled(button.getSelection());
        }
    });

}

From source file:org.robotframework.ide.eclipse.main.plugin.preferences.DefaultLaunchConfigurationPreferencePage.java

License:Apache License

private void createRobotLaunchConfigurationPreferences(final Composite parent) {
    final Group group = new Group(parent, SWT.NONE);
    group.setText("Robot tab");
    GridLayoutFactory.fillDefaults().applyTo(group);
    GridDataFactory.fillDefaults().grab(true, false).indent(0, 10).span(2, 1).applyTo(group);

    final StringFieldEditor additionalRobotArguments = new StringFieldEditor(
            RedPreferences.LAUNCH_ADDITIONAL_ROBOT_ARGUMENTS, "Additional Robot Framework arguments:", group);
    additionalRobotArguments.load();/*from  www . j ava 2 s .c  o  m*/
    addField(additionalRobotArguments);

    GridDataFactory.fillDefaults().grab(true, false).applyTo(additionalRobotArguments.getLabelControl(group));
}

From source file:org.robotframework.ide.eclipse.main.plugin.preferences.DefaultLaunchConfigurationPreferencePage.java

License:Apache License

private void createListenerLaunchConfigurationPreferences(final Composite parent) {
    final Group group = new Group(parent, SWT.NONE);
    group.setText("Listener tab");
    GridLayoutFactory.fillDefaults().applyTo(group);
    GridDataFactory.fillDefaults().grab(true, false).indent(0, 10).span(2, 1).applyTo(group);

    remoteHost = new StringFieldEditor(RedPreferences.LAUNCH_AGENT_CONNECTION_HOST, "Server IP:", group);
    remoteHost.setEmptyStringAllowed(false);
    remoteHost.setErrorMessage("Server IP cannot be empty");
    remoteHost.load();// w w  w  . j ava 2s.  c om
    addField(remoteHost);

    remotePort = new IntegerFieldEditor(RedPreferences.LAUNCH_AGENT_CONNECTION_PORT, "Server port:", group);
    remotePort.setValidRange(AgentConnectionServer.MIN_CONNECTION_PORT,
            AgentConnectionServer.MAX_CONNECTION_PORT);
    remotePort.load();
    addField(remotePort);

    remoteTimeout = new IntegerFieldEditor(RedPreferences.LAUNCH_AGENT_CONNECTION_TIMEOUT,
            "Server connection timeout [s]:", group);
    remoteTimeout.setValidRange(AgentConnectionServer.MIN_CONNECTION_TIMEOUT,
            AgentConnectionServer.MAX_CONNECTION_TIMEOUT);
    remoteTimeout.load();
    addField(remoteTimeout);

    final Button exportBtn = new Button(group, SWT.PUSH);
    GridDataFactory.swtDefaults().indent(25, 5).applyTo(exportBtn);
    exportBtn.setText("Export Client Script");
    exportBtn.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent event) {
            new ScriptExportDialog(getShell(), "TestRunnerAgent.py").open();
        }
    });
}