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.springframework.tooling.boot.ls.XmlConfigPreferencePage.java

License:Open Source License

@Override
protected void createFieldEditors() {
    Composite fieldEditorParent = getFieldEditorParent();
    final boolean xmlEnabled = getPreferenceStore().getBoolean(Constants.PREF_SUPPORT_SPRING_XML_CONFIGS);
    updateXmlSettingControlsEnablement = new ArrayList<>();

    enableEditor = new BooleanFieldEditor(Constants.PREF_SUPPORT_SPRING_XML_CONFIGS,
            "Enable Spring XML Config files support", fieldEditorParent);
    addField(enableEditor);//from  ww  w  .  j a v a  2 s  . c  o  m

    Label label = new Label(fieldEditorParent, SWT.SEPARATOR | SWT.HORIZONTAL);
    label.setLayoutData(
            GridDataFactory.swtDefaults().grab(true, false).span(2, 1).align(SWT.FILL, SWT.BEGINNING).create());

    Composite settingsComposite = new Composite(fieldEditorParent, SWT.NONE);
    settingsComposite.setLayoutData(
            GridDataFactory.swtDefaults().grab(true, true).align(SWT.FILL, SWT.BEGINNING).create());
    settingsComposite.setLayout(new GridLayout(1, false));

    BooleanFieldEditor caFieldEditor = new BooleanFieldEditor(Constants.PREF_XML_CONFIGS_CONTENT_ASSIST,
            "Content Assist in editor", settingsComposite);
    addField(caFieldEditor);
    caFieldEditor.setEnabled(xmlEnabled, settingsComposite);
    updateXmlSettingControlsEnablement
            .add(() -> caFieldEditor.setEnabled(enableEditor.getBooleanValue(), settingsComposite));

    BooleanFieldEditor hyperlinkEditor = new BooleanFieldEditor(Constants.PREF_XML_CONFIGS_HYPERLINKS,
            "Hyperlinks in editor", settingsComposite);
    addField(hyperlinkEditor);
    hyperlinkEditor.setEnabled(xmlEnabled, settingsComposite);
    updateXmlSettingControlsEnablement
            .add(() -> hyperlinkEditor.setEnabled(enableEditor.getBooleanValue(), settingsComposite));

    Composite scanFoldersComposite = new Composite(settingsComposite, SWT.NONE);
    scanFoldersComposite.setFont(settingsComposite.getFont());
    scanFoldersComposite.setLayoutData(GridDataFactory.swtDefaults().span(2, 1)
            .align(GridData.FILL, GridData.BEGINNING).grab(true, false).create());
    scanFoldersComposite.setLayout(new GridLayout(2, false));
    StringFieldEditor scanGlobEditor = new StringFieldEditor(Constants.PREF_XML_CONFIGS_SCAN_FOLDERS,
            "Scan XML in folders for symbols:", scanFoldersComposite);
    addField(scanGlobEditor);
    scanGlobEditor.setEnabled(xmlEnabled, scanFoldersComposite);
    updateXmlSettingControlsEnablement
            .add(() -> scanGlobEditor.setEnabled(enableEditor.getBooleanValue(), scanFoldersComposite));

}

From source file:org.talend.core.prefs.collector.TalendDataCollectorUploadingPreferencePage.java

License:Open Source License

@Override
protected void createFieldEditors() {

    Composite fieldEditorParent = getFieldEditorParent();

    IntegerFieldEditor uploadPeriodField = new IntegerFieldEditor(
            ITalendCorePrefConstants.DATA_COLLECTOR_UPLOAD_PERIOD,
            Messages.getString("TalendDataCollectorUploadingPreferencePage_UploadPeriod"), fieldEditorParent) { //$NON-NLS-1$

        @Override/*w w w .j a v a2 s  .  c o m*/
        protected void createControl(Composite parent) {
            super.createControl(parent);
            Label label = new Label(parent, SWT.NONE);
            label.setText(Messages.getString("TalendDataCollectorUploadingPreferencePage_Days")); //$NON-NLS-1$
        }

        public int getNumberOfControls() {
            return 3;
        }

    };
    addField(uploadPeriodField);
    uploadPeriodField.setValidRange(0, Integer.MAX_VALUE);
    Text uploadPeriodText = uploadPeriodField.getTextControl(fieldEditorParent);
    GridData gridData1 = new GridData();
    gridData1.minimumWidth = 100;
    gridData1.widthHint = 100;
    uploadPeriodText.setLayoutData(gridData1);

    lastUploadField = new StringFieldEditor(ITalendCorePrefConstants.DATA_COLLECTOR_LAST_TIME,
            Messages.getString("TalendDataCollectorUploadingPreferencePage_LastUpload"), fieldEditorParent); //$NON-NLS-1$
    Text lastUploadText = lastUploadField.getTextControl(fieldEditorParent);
    lastUploadText.setEditable(false);
    lastUploadText.setEnabled(false);
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 2;
    lastUploadText.setLayoutData(gridData);

    GridLayout layout = new GridLayout();
    layout.numColumns = 3;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    fieldEditorParent.setLayout(layout);

    addField(lastUploadField);
}

From source file:org.talend.designer.core.ui.preferences.DesignerPreferencePage.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   ww  w . ja  va2 s  . co  m*/
@Override
public void createFieldEditors() {
    StringFieldEditor labelField;
    StringFieldEditor hintField;
    StringFieldEditor connectionField;
    BooleanFieldEditor showHint;
    // BooleanFieldEditor displayComponent;
    BooleanFieldEditor useRepositoryName;
    // BooleanFieldEditor deactiveRepositoryUpdate;

    labelField = new StringFieldEditor(TalendDesignerPrefConstants.DEFAULT_LABEL,
            Messages.getString("DesignerPreferencePage.component.defaultLabel"), //$NON-NLS-1$
            getFieldEditorParent());
    hintField = new StringFieldEditor(TalendDesignerPrefConstants.DEFAULT_HINT,
            Messages.getString("DesignerPreferencePage.component.defaultHint"), //$NON-NLS-1$
            getFieldEditorParent());
    connectionField = new StringFieldEditor(TalendDesignerPrefConstants.DEFAULT_CONNECTION_FORMAT,
            Messages.getString("DesignerPreferencePage.defaultConnection"), getFieldEditorParent()); //$NON-NLS-1$
    showHint = new BooleanFieldEditor(TalendDesignerPrefConstants.DEFAULT_HINT_USED,
            Messages.getString("DesignerPreferencePage.hintShowed"), //$NON-NLS-1$
            getFieldEditorParent());
    // displayComponent = new BooleanFieldEditor(TalendDesignerPrefConstants.DEFAULT_DISPLAY, Messages
    // .getString("DesignerPreferencePage.display.hiddenComponents"), getFieldEditorParent()); //$NON-NLS-1$
    useRepositoryName = new BooleanFieldEditor(TalendDesignerPrefConstants.USE_REPOSITORY_NAME,
            Messages.getString("DesignerPreferencePage.display.useRepositoryName"), getFieldEditorParent()); //$NON-NLS-1$

    // deactiveRepositoryUpdate = new BooleanFieldEditor(ITalendCorePrefConstants.DEACTIVE_REPOSITORY_UPDATE,
    // Messages
    //                .getString("DesignerPreferencePage.display.deactiveRepositoryUpdate"), getFieldEditorParent()); //$NON-NLS-1$

    addField(labelField);
    addField(hintField);
    addField(connectionField);
    addField(showHint);
    // addField(displayComponent);
    addField(useRepositoryName);
    // addField(deactiveRepositoryUpdate);

    // addField(new BooleanFieldEditor(TalendDesignerPrefConstants.PROPERTY_CODE_CHECK, Messages
    //                .getString("DesignerPreferencePage.propertyCodeCheck"), getFieldEditorParent())); //$NON-NLS-1$

    BooleanFieldEditor antialiasing;
    antialiasing = new BooleanFieldEditor(TalendDesignerPrefConstants.EDITOR_ANTIALIASING,
            Messages.getString("DesignerPreferencePage.actionInJobDesigner"), getFieldEditorParent()); //$NON-NLS-1$
    addField(antialiasing);

    BooleanFieldEditor lineStyle;
    lineStyle = new BooleanFieldEditor(TalendDesignerPrefConstants.EDITOR_LINESTYLE,
            Messages.getString("DesignerPreferencePage.lineStyle"), getFieldEditorParent()); //$NON-NLS-1$
    addField(lineStyle);

    if (PluginChecker.isTestCasePluginLoaded()) {
        BooleanFieldEditor duplicateTestCases;
        duplicateTestCases = new BooleanFieldEditor(TalendDesignerPrefConstants.DUPLICATE_TESTCASE,
                Messages.getString("DesignerPreferencePage.duplicateTestCases"), getFieldEditorParent()); //$NON-NLS-1$
        addField(duplicateTestCases);
    }

    DirectoryFieldEditor compDefaultFileDir = new DirectoryFieldEditor(
            TalendDesignerPrefConstants.COMP_DEFAULT_FILE_DIR,
            Messages.getString("DesignerPreferencePage.defaultFilePathDirectory"), getFieldEditorParent()) {

        @Override
        // wzhang added to set the separator as "/" of default component filePath in preference.
        protected String changePressed() {
            File f = new File(getTextControl().getText());
            if (!f.exists()) {
                f = null;
            }
            DirectoryDialog fileDialog = new DirectoryDialog(getShell(), SWT.OPEN);
            if (f != null) {
                fileDialog.setFilterPath(f.getPath());
            }
            String openDir = fileDialog.open();
            if (openDir != null) {
                openDir.trim();
                if (openDir.length() > 0) {
                    File filePath = new File(openDir);
                    if (!filePath.exists()) {
                        return null;
                    }
                }
                return Path.fromOSString(openDir).toPortableString();
            }
            return null;
        }
    };
    addField(compDefaultFileDir);

    RadioGroupFieldEditor largeIconsSizeField = new RadioGroupFieldEditor(
            TalendDesignerPrefConstants.LARGE_ICONS_SIZE,
            Messages.getString("DesignerPreferencePage.largeIconsSize"), 2, //$NON-NLS-1$
            new String[][] { { Messages.getString("DesignerPreferencePage.iconSize24"), "" + 24 }, //$NON-NLS-1$ //$NON-NLS-2$ 
                    { Messages.getString("DesignerPreferencePage.iconSize32"), "" + 32 } }, //$NON-NLS-1$//$NON-NLS-2$
            getFieldEditorParent());
    addField(largeIconsSizeField);

    // disable this feature 1722 for the M1 release as it's not used yet in Perl or Java.

    // RadioGroupFieldEditor schemaOptions = new RadioGroupFieldEditor(
    // TalendDesignerPrefConstants.SCHEMA_OPTIONS,
    // Messages.getString("DesignerPreferencePage.schemaOptions"), 4, new String[][] { { "do nothing", "nothing" },
    // { "die", "die" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    // { "warn", "warn" }, { "enlarge or truncate row", "adapt" } }, getFieldEditorParent(), true); //$NON-NLS-1$
    // //$NON-NLS-2$
    // addField(schemaOptions);

    RadioGroupFieldEditor viewOptions = new RadioGroupFieldEditor(TalendDesignerPrefConstants.VIEW_OPTIONS,
            Messages.getString("DesignerPreferencePage.viewOptions"), 2, //$NON-NLS-1$
            new String[][] { { Messages.getString("DesignerPreferencePage.compactView"), "default" }, //$NON-NLS-1$ //$NON-NLS-2$
                    { Messages.getString("DesignerPreferencePage.tableView"), "table view" } }, //$NON-NLS-1$//$NON-NLS-2$
            getFieldEditorParent(), true);
    addField(viewOptions);

    // BooleanFieldEditor viewSubjobs = new BooleanFieldEditor(TalendDesignerPrefConstants.DISPLAY_SUBJOBS,
    // "Highlight subjobs in the job designs", getFieldEditorParent());
    // addField(viewSubjobs);
    // BooleanFieldEditor generateCodeWhenOpenJob = new BooleanFieldEditor(
    // TalendDesignerPrefConstants.GENERATE_CODE_WHEN_OPEN_JOB, Messages
    //                        .getString("DesignerPreferencePage.generateCode"), //$NON-NLS-1$
    // getFieldEditorParent());
    // addField(generateCodeWhenOpenJob);

    // When updating jobs or joblets, check only the last version, and checked by default
    // BooleanFieldEditor checkOnlyLastVersion = new
    // BooleanFieldEditor(TalendDesignerPrefConstants.CHECK_ONLY_LAST_VERSION,
    //                Messages.getString("DesignerPreferencePage.checkVersion"), getFieldEditorParent()); //$NON-NLS-1$
    // addField(checkOnlyLastVersion);

    // BooleanFieldEditor propagateContextVariable = new BooleanFieldEditor(
    // TalendDesignerPrefConstants.PROPAGATE_CONTEXT_VARIABLE, Messages
    //                        .getString("DesignerPreferencePage.addOrDeleteVariable"), getFieldEditorParent()); //$NON-NLS-1$
    // addField(propagateContextVariable);

    BooleanFieldEditor displayMethodSize = new BooleanFieldEditor(
            TalendDesignerPrefConstants.DISPLAY_METHOD_SIZE,
            Messages.getString("DesignerPreferencePage.computeLength"), getFieldEditorParent()); //$NON-NLS-1$
    addField(displayMethodSize);

    BooleanFieldEditor allowDelConnWithJLTriggLinkCompField = new BooleanFieldEditor(
            TalendDesignerPrefConstants.NOT_SHOW_WARNING_WHEN_DELETE_LINK_WITH_JOBLETTRIGGERLINKCOMPONENT,
            Messages.getString("DesignerPreferencePage.notShowWarningDialog"), getFieldEditorParent()); //$NON-NLS-1$
    addField(allowDelConnWithJLTriggLinkCompField);
}

From source file:org.talend.designer.core.ui.preferences.DocumentationPreferencePage.java

License:Open Source License

@Override
protected void createFieldEditors() {
    sourceCodeGenFieldEditor = new BooleanFieldEditor(ITalendCorePrefConstants.DOC_GENERATESOURCECODE,
            org.talend.repository.i18n.Messages.getString("DocumentationPreferencePage.sourceCodeToHTML"), //$NON-NLS-1$
            getFieldEditorParent());//from   w  w  w.ja v a2s .c o m
    addField(sourceCodeGenFieldEditor);

    // see the bug 7073,qli
    if (isDocumentationPluginLoaded) {
        BooleanFieldEditor booleanFieldEditor = new BooleanFieldEditor(ITalendCorePrefConstants.DOC_GENERATION,
                Messages.getString("PerformancePreferencePage.autoUpdateDoc"), getFieldEditorParent()); //$NON-NLS-1$
        addField(booleanFieldEditor);

        FileFieldEditor documentationLogo = new FileFieldEditor(ITalendCorePrefConstants.DOC_USER_LOGO,
                Messages.getString("DocumentationPreferencePage.userDocLogo"), getFieldEditorParent());
        addField(documentationLogo);

        StringFieldEditor companyName = new StringFieldEditor(ITalendCorePrefConstants.DOC_COMPANY_NAME,
                Messages.getString("DocumentationPreferencePage.companyName"), getFieldEditorParent());
        addField(companyName);
    }

    useCss = new BooleanFieldEditor(ITalendCorePrefConstants.USE_CSS_TEMPLATE,
            Messages.getString("DocumentationPreferencePage.use_css_template"), getFieldEditorParent()); //$NON-NLS-1$
    addField(useCss);

    documentCssFile = new FileFieldEditor(ITalendCorePrefConstants.CSS_FILE_PATH,
            Messages.getString("DocumentationPreferencePage.css_file"), getFieldEditorParent()); //$NON-NLS-1$
    documentCssFile.setFileExtensions(new String[] { "*.css" }); //$NON-NLS-1$
    addField(documentCssFile);
    activateFields(getPreferenceStore().getBoolean(ITalendCorePrefConstants.USE_CSS_TEMPLATE));
    addCssFileListener();
}