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, int width, Composite parent) 

Source Link

Document

Creates a string field editor.

Usage

From source file:org.genivi.commonapi.core.ui.preferences.CommonAPIPreferencePage.java

License:Mozilla Public 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 2  s.com
@Override
public void createFieldEditors() {
    generatSkeleton = new BooleanFieldEditor(PreferenceConstants.P_GENERATE_SKELETON, "Generate skeleton code",
            getFieldEditorParent());
    addField(generatSkeleton);

    license = new MultiLineStringFieldEditor(PreferenceConstants.P_LICENSE,
            "The license header to be inserted in all generated files", 30, getFieldEditorParent());
    license.setLabelText(""); // need to set this parameter (seems to be a bug)
    addField(license);

    // output directory definitions
    commonOutput = new StringFieldEditor(PreferenceConstants.P_OUTPUT_COMMON,
            "Output directory for the common code", 30, getFieldEditorParent());
    addField(commonOutput);
    proxyOutput = new StringFieldEditor(PreferenceConstants.P_OUTPUT_PROXIES, "Output directory for proxy code",
            30, getFieldEditorParent());
    addField(proxyOutput);
    stubOutput = new StringFieldEditor(PreferenceConstants.P_OUTPUT_STUBS, "Output directory for stub code", 30,
            getFieldEditorParent());
    addField(stubOutput);
    skeletonOutput = new StringFieldEditor(PreferenceConstants.P_OUTPUT_SKELETON,
            "Output directory for the skeleton code", 30, getFieldEditorParent());
    addField(skeletonOutput);

    postFix = new StringFieldEditor(PreferenceConstants.P_SKELETONPOSTFIX, "Postfix for skeleton filenames", 30,
            getFieldEditorParent());
    addField(postFix);
    postFix.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE);

    enumPrefix = new StringFieldEditor(PreferenceConstants.P_ENUMPREFIX, "Prefix for enumeration literals", 30,
            getFieldEditorParent());
    addField(enumPrefix);
}

From source file:org.genivi.commonapi.dbus.ui.preferences.CommonAPIDBusPreferencePage.java

License:Mozilla Public 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  om
@Override
public void createFieldEditors() {
    license = new MultiLineStringFieldEditor(PreferenceConstantsDBus.P_LICENSE_DBUS,
            "The header to insert for all generated files", 60, getFieldEditorParent());
    license.setLabelText(""); // need to set this parameter (seems to be a bug)
    addField(license);
    // output directory definitions
    commonOutput = new StringFieldEditor(PreferenceConstantsDBus.P_OUTPUT_COMMON_DBUS,
            "Output directory for the common part", 30, getFieldEditorParent());
    addField(commonOutput);
    proxyOutput = new StringFieldEditor(PreferenceConstantsDBus.P_OUTPUT_PROXIES_DBUS,
            "Output directory for proxies inside project", 30, getFieldEditorParent());
    addField(proxyOutput);
    stubOutput = new StringFieldEditor(PreferenceConstantsDBus.P_OUTPUT_STUBS_DBUS,
            "Output directory for stubs inside project", 30, getFieldEditorParent());
    addField(stubOutput);

}

From source file:org.genivi.commonapi.someip.ui.preferences.CommonAPISomeIPPreferencePage.java

License:Mozilla Public 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 a  2 s.  co m
@Override
public void createFieldEditors() {
    deploymentValidation = new BooleanFieldEditor(
            PreferenceConstantsSomeIP.P_ENABLE_SOMEIP_DEPLOYMENT_VALIDATOR, "Validate deployment",
            getFieldEditorParent());
    addField(deploymentValidation);

    license = new MultiLineStringFieldEditor(PreferenceConstantsSomeIP.P_LICENSE_SOMEIP,
            "The header to insert for all generated files", 60, getFieldEditorParent());
    license.setLabelText(""); // need to set this parameter (seems to be a bug)
    addField(license);
    commonOutput = new StringFieldEditor(PreferenceConstantsSomeIP.P_OUTPUT_COMMON_SOMEIP,
            "Output directory for the common part", 30, getFieldEditorParent());
    addField(commonOutput);
    proxyOutput = new StringFieldEditor(PreferenceConstantsSomeIP.P_OUTPUT_PROXIES_SOMEIP,
            "Output directory for proxies inside project", 30, getFieldEditorParent());
    addField(proxyOutput);
    stubOutput = new StringFieldEditor(PreferenceConstantsSomeIP.P_OUTPUT_STUBS_SOMEIP,
            "Output directory for stubs inside project", 30, getFieldEditorParent());
    addField(stubOutput);
}

From source file:org.juke.stringutils.StringUtilsPreferencePage.java

License:Open Source License

public void createFieldEditors() {
    addField(new BooleanFieldEditor(CLAUSE_TO_UPPERCASE, CONVER_SQL_CLAUSES_TO_UPPER_CASE,
            getFieldEditorParent()));/*w w w. j ava  2  s.  co  m*/
    addField(new BooleanFieldEditor(FORMATTE_SQL_ON_EXTRACT, FORMATTE_SQL_QUERY_ON_EXTRACT,
            getFieldEditorParent()));
    addField(new StringFieldEditor(NEXT_LINE_OFFSET, NEXT_LINE_OFFSET_LABEL, 3, getFieldEditorParent()));
    addField(new StringFieldEditor(SQL_INITIAL_LINE_OFFSET, SQL_INITIAL_LINE_OFFSET_LABEL, 3,
            getFieldEditorParent()));
    addField(new StringFieldEditor(LINE_WIDTH, LINE_WIDTH_LABEL, 3, getFieldEditorParent()));
}

From source file:org.python.pydev.editor.commentblocks.CommentBlocksPreferences.java

License:Open Source License

@Override
protected void createFieldEditors() {
    final Composite p = getFieldEditorParent();
    multiBlock = new StringFieldEditor(MULTI_BLOCK_COMMENT_CHAR, "Multi-block char (ctrl+4):", 2, p);
    multiBlock.getTextControl(p).setTextLimit(1);
    multiBlock.setEmptyStringAllowed(false);
    addField(multiBlock);/*from  www . j a  v  a 2 s.  c  o  m*/

    addField(new BooleanFieldEditor(MULTI_BLOCK_COMMENT_SHOW_ONLY_CLASS_NAME,
            "In a class name, create block only with class name above of class?", p));
    addField(new BooleanFieldEditor(MULTI_BLOCK_COMMENT_SHOW_ONLY_FUNCTION_NAME,
            "In a function name, create block only with function name above of function?", p));

    labelMulti = new Label(p, SWT.NONE);

    singleBlock = new StringFieldEditor(SINGLE_BLOCK_COMMENT_CHAR, "Single-block char (ctrl+shift+4):", 2, p);
    singleBlock.setEmptyStringAllowed(false);
    singleBlock.getTextControl(p).setTextLimit(1);
    addField(singleBlock);

    alignSingle = new BooleanFieldEditor(SINGLE_BLOCK_COMMENT_ALIGN_RIGHT,
            "Align text in single-block to the right?", p);
    addField(alignSingle);
    labelSingle = new Label(p, SWT.NONE);

    IPreferenceStore store = getPreferenceStore();
    setLabelFont(p, labelSingle);
    setLabelFont(p, labelMulti);

    updateMulti(store.getString(MULTI_BLOCK_COMMENT_CHAR));
    updateSingle(store.getString(SINGLE_BLOCK_COMMENT_CHAR),
            store.getBoolean(SINGLE_BLOCK_COMMENT_ALIGN_RIGHT));
}

From source file:org.python.pydev.editor.saveactions.PydevSaveActionsPrefPage.java

License:Open Source License

@Override
protected void createFieldEditors() {

    IInformationPresenter presenter = new AbstractTooltipInformationPresenter() {
        @Override//from  w  w  w  . ja  v a2 s  .  co m
        protected void onUpdatePresentation(String hoverInfo, TextPresentation presentation) {
        }

        @Override
        protected void onHandleClick(Object data) {
        }
    };

    final Composite p = getFieldEditorParent();

    addField(new BooleanFieldEditor(SAVE_ACTIONS_ONLY_ON_WORKSPACE_FILES,
            "Apply save actions only to files in the workspace?", p));

    addField(new BooleanFieldEditor(FORMAT_BEFORE_SAVING, "Auto-format editor contents before saving?", p));

    addField(new LinkFieldEditor("link_formatpreferences", "Note: config in <a>code formatting preferences</a>",
            p, new SelectionListener() {

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

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

    // Sort imports when file is saved?
    sortImportsOnSave = new BooleanFieldEditor(SORT_IMPORTS_ON_SAVE, "Sort imports on save?", p);
    addField(sortImportsOnSave);

    addField(new LinkFieldEditor("link_importpreferences",
            "Note: config in <a>code style: imports preferences</a>", p, new SelectionListener() {

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

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

    tooltipPresenter = new ToolTipPresenterHandler(p.getShell(), presenter,
            "Tip: Click link to open SimpleDateFormat Java docs online.");

    // Enable date field action editor (boolean)
    IPreferenceStore prefStore = getPreferenceStore();
    final String fieldName = prefStore.getString(DATE_FIELD_NAME);
    final String enableDateFieldActionEditorTooltip = String.format(enableDateFieldActionEditorTooltipFormat,
            fieldName);

    enableDateFieldActionEditor = new BooleanFieldEditor(ENABLE_DATE_FIELD_ACTION, "Update date field?", p);

    enableDateFieldActionEditor.getDescriptionControl(p).setToolTipText(enableDateFieldActionEditorTooltip);
    addField(enableDateFieldActionEditor);

    // Date field name editor (string)

    fieldNameEditor = new PydevDateFieldNameEditor(DATE_FIELD_NAME, "Date field name:",
            PydevDateFieldNameEditor.UNLIMITED, p);
    fieldNameEditor.getTextControl(p).setToolTipText(String.format("Default is %s", DEFAULT_DATE_FIELD_NAME));
    fieldNameEditor.setEmptyStringAllowed(false);
    //fieldNameEditor.setValidateStrategy(PydevDateFieldNameEditor.VALIDATE_ON_FOCUS_LOST);
    fieldNameEditor.setEnabled(prefStore.getBoolean(ENABLE_DATE_FIELD_ACTION), p);
    addField(fieldNameEditor);

    // Date format editor (string)

    dateFormatEditor = new StringFieldEditor(DATE_FIELD_FORMAT, "Date field format:",
            StringFieldEditor.UNLIMITED, p);
    dateFormatEditor.getTextControl(p).setToolTipText("Uses Java's SimpleDateFormat tokens.");
    dateFormatEditor.setEmptyStringAllowed(false);
    //dateFormatEditor.setValidateStrategy(StringFieldEditor.VALIDATE_ON_FOCUS_LOST);
    dateFormatEditor.setEnabled(prefStore.getBoolean(ENABLE_DATE_FIELD_ACTION), p);
    addField(dateFormatEditor);

    // Token help editor (link)

    final String dateFormatHelpLinkTooltip = "" + "All tokens from Java's SimpleDateFormat class\n"
            + "are supported. The most common ones are:\n" + "\n" + "y\t\tYear\n" + "M\t\tMonth in year\n"
            + "d\t\tDay in month\n" + "E\t\tDay name in week\n" + "H\t\tHour in day (0-23)\n"
            + "h\t\tHour in am/pm (1-12)\n" + "m\t\tMinute in hour\n" + "s\t\tSecond in minute\n" + "\n"
            + "Enclose literal characters in single quotes.";

    dateFormatHelpLinkEditor = new LinkFieldEditor("link_dateFormat", "<a>Supported tokens</a>", p,
            new PydevSaveActionsPrefPage.PydevSaveActionsPageLinkListener(), dateFormatHelpLinkTooltip,
            tooltipPresenter);
    addField(dateFormatHelpLinkEditor);

    addField(new LabelFieldEditor("__dummy__", "I.e.: __updated__=\"2010-01-01\" will be synched on save.", p));

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

}

From source file:org.python.pydev.ui.filetypes.FileTypesPreferencesPage.java

License:Open Source License

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

    addField(new LabelFieldEditorWith2Cols("Label_Info_File_Preferences1",
            WrapAndCaseUtils.wrap(//w  ww.  j  av  a 2s . co  m
                    "These setting are used to know which files should be considered valid internally, and are "
                            + "not used in the file association of those files to the pydev editor.\n\n",
                    80),
            p) {
        @Override
        public String getLabelTextCol1() {
            return "Note:\n\n";
        }
    });

    addField(new LabelFieldEditorWith2Cols("Label_Info_File_Preferences2", WrapAndCaseUtils.wrap(
            "After changing those settings, a manual reconfiguration of the interpreter and a manual rebuild "
                    + "of the projects may be needed to update the inner caches that may be affected by those changes.\n\n",
            80), p) {
        @Override
        public String getLabelTextCol1() {
            return "Important:\n\n";
        }
    });

    addField(new StringFieldEditor(VALID_SOURCE_FILES, "Valid source files (comma-separated):",
            StringFieldEditor.UNLIMITED, p));
    addField(new StringFieldEditor(FIRST_CHOICE_PYTHON_SOURCE_FILE, "Default python extension:",
            StringFieldEditor.UNLIMITED, p));
}

From source file:org.springframework.ide.eclipse.osgi.runtime.ui.OSGiRuntimePreferencePage.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {

    Composite entryTable = new Composite(parent, SWT.NULL);

    // Create a data that takes up the extra space in the dialog .
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.grabExcessHorizontalSpace = true;
    entryTable.setLayoutData(data);//from w ww. j a v a2s  .  c  o m

    GridLayout layout = new GridLayout();
    entryTable.setLayout(layout);

    Label label = new Label(entryTable, SWT.NONE | SWT.WRAP);
    label.setText(
            "Use this preference page to specify the port number needed to connect to an running Equinox console.");
    label.setFont(parent.getFont());
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 1;
    gd.widthHint = 300;
    label.setLayoutData(gd);

    Composite radioComposite = new Composite(entryTable, SWT.NONE);
    radioComposite.setLayout(new GridLayout());

    // Create a data that takes up the extra space in the dialog.
    radioComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Composite radioComposite2 = new Composite(radioComposite, SWT.NONE);
    layout.marginWidth = 3;
    layout.marginHeight = 3;
    radioComposite2.setLayout(layout);
    radioComposite2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    textEditor = new StringFieldEditor(OsgiPlugin.PORT_PREFERENCE_KEY, "Port number:", 10, radioComposite2);
    textEditor.setPage(this);
    textEditor.setPreferenceStore(getPreferenceStore());
    textEditor.load();

    Label noteLabel = new Label(radioComposite, SWT.NONE | SWT.WRAP);
    noteLabel.setText("Note: the port number will also be available by using the "
            + "${osgi.console.port} placeholder in the OSGi Framework launch configuration.");
    noteLabel.setFont(parent.getFont());
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 1;
    gd.widthHint = 300;
    noteLabel.setLayoutData(gd);

    return entryTable;
}