Example usage for org.eclipse.jface.preference StringFieldEditor UNLIMITED

List of usage examples for org.eclipse.jface.preference StringFieldEditor UNLIMITED

Introduction

In this page you can find the example usage for org.eclipse.jface.preference StringFieldEditor UNLIMITED.

Prototype

int UNLIMITED

To view the source code for org.eclipse.jface.preference StringFieldEditor UNLIMITED.

Click Source Link

Document

Text limit constant (value -1) indicating unlimited text limit and width.

Usage

From source file:org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositorySettingsPage.java

License:Open Source License

private void createRepositoryCredentialsSection() {
    repositoryUserNameEditor = new StringFieldEditor("", LABEL_USER, StringFieldEditor.UNLIMITED, //$NON-NLS-1$
            compositeContainer) {/*from   ww w.  ja v a  2s  . c  o  m*/

        @Override
        protected boolean doCheckState() {
            return true;
        }

        @Override
        protected void valueChanged() {
            super.valueChanged();
            isPageComplete();
            if (getWizard() != null) {
                getWizard().getContainer().updateButtons();
            }
        }

        @Override
        public int getNumberOfControls() {
            // always 2 columns -- if no anonymous checkbox, just leave 3rd column empty
            return 2;
        }
    };
    if (needsAnonymousLogin()) {
        // need to increase column number here, because above string editor will use them if declared beforehand
        //((GridLayout) (compositeContainer.getLayout())).numColumns++;
        anonymousButton = new Button(compositeContainer, SWT.CHECK);

        anonymousButton.setText(Messages.AbstractRepositorySettingsPage_Anonymous_Access);
        anonymousButton.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                setAnonymous(anonymousButton.getSelection());
                isPageComplete();
            }
        });
    } else {
        Label dummyLabel = new Label(compositeContainer, SWT.NONE); // dummy control to fill 3rd column when no anonymous login
        GridDataFactory.fillDefaults().applyTo(dummyLabel); // not really necessary, but to be on the safe side
    }

    repositoryPasswordEditor = new RepositoryStringFieldEditor("", LABEL_PASSWORD, StringFieldEditor.UNLIMITED, //$NON-NLS-1$
            compositeContainer) {

        @Override
        protected boolean doCheckState() {
            return true;
        }

        @Override
        protected void valueChanged() {
            super.valueChanged();
            isPageComplete();
            if (getWizard() != null) {
                getWizard().getContainer().updateButtons();
            }
        }

        @Override
        public int getNumberOfControls() {
            return 2;
        }
    };

    savePasswordButton = new Button(compositeContainer, SWT.CHECK);
    savePasswordButton.setText(Messages.AbstractRepositorySettingsPage_Save_Password);
    savePasswordButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            super.widgetSelected(e);
            isPageComplete();
            if (getWizard() != null) {
                getWizard().getContainer().updateButtons();
            }
        }
    });

    if (repository != null) {
        try {
            String repositoryLabel = repository.getProperty(IRepositoryConstants.PROPERTY_LABEL);
            if (repositoryLabel != null && repositoryLabel.length() > 0) {
                // repositoryLabelCombo.add(repositoryLabel);
                // repositoryLabelCombo.select(0);
                repositoryLabelEditor.setStringValue(repositoryLabel);
            }
            serverUrlCombo.setText(repository.getRepositoryUrl());
            AuthenticationCredentials credentials = repository.getCredentials(AuthenticationType.REPOSITORY);
            if (credentials != null) {
                repositoryUserNameEditor.setStringValue(credentials.getUserName());
                repositoryPasswordEditor.setStringValue(credentials.getPassword());
            } else {
                repositoryUserNameEditor.setStringValue(""); //$NON-NLS-1$
                repositoryPasswordEditor.setStringValue(""); //$NON-NLS-1$
            }
        } catch (Throwable t) {
            StatusHandler
                    .log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Could not set field value", t)); //$NON-NLS-1$
        }
    }

    if (needsAnonymousLogin()) {
        if (repository != null) {
            setAnonymous(repository.getCredentials(AuthenticationType.REPOSITORY) == null);
        } else {
            setAnonymous(true);
        }
    }
    if (repository != null) {
        savePasswordButton.setSelection(repository.getSavePassword(AuthenticationType.REPOSITORY));
    } else {
        savePasswordButton.setSelection(false);
    }
    RepositoryUiUtil.testCredentialsStore(getRepositoryUrl(), this);
}

From source file:org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositorySettingsPage.java

License:Open Source License

private void createCertAuthSection() {
    ExpandableComposite section = createSection(innerComposite,
            Messages.AbstractRepositorySettingsPage_certificate_settings);

    certAuthComp = toolkit.createComposite(section, SWT.NONE);
    certAuthComp.setBackground(compositeContainer.getBackground());
    section.setClient(certAuthComp);// ww  w  .  j ava 2s  .  c  o m

    certAuthButton = new Button(certAuthComp, SWT.CHECK);
    GridDataFactory.fillDefaults().indent(0, 5).align(SWT.LEFT, SWT.TOP).span(3, SWT.DEFAULT)
            .applyTo(certAuthButton);

    certAuthButton.setText(Messages.AbstractRepositorySettingsPage_Enable_certificate_authentification);

    certAuthButton.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent e) {
            setCertAuth(certAuthButton.getSelection());
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            // ignore
        }
    });

    certAuthFileNameEditor = new StringFieldEditor("", Messages.AbstractRepositorySettingsPage_CertificateFile_, //$NON-NLS-1$
            StringFieldEditor.UNLIMITED, certAuthComp) {

        @Override
        protected boolean doCheckState() {
            return true;
        }

        @Override
        protected void valueChanged() {
            super.valueChanged();
            if (getWizard() != null) {
                getWizard().getContainer().updateButtons();
            }
        }

        @Override
        public int getNumberOfControls() {
            return 2;
        }
    };

    certBrowseButton = new Button(certAuthComp, SWT.PUSH);
    certBrowseButton.setText(Messages.AbstractRepositorySettingsPage_ChooseCertificateFile_);
    certBrowseButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            FileDialog fileDialog = new FileDialog(getShell(), SWT.OPEN);
            fileDialog.setFilterPath(System.getProperty("user.home", ".")); //$NON-NLS-1$ //$NON-NLS-2$
            String returnFile = fileDialog.open();
            if (returnFile != null) {
                certAuthFileNameEditor.setStringValue(returnFile);
            }
        }
    });

    certAuthPasswordEditor = new RepositoryStringFieldEditor("", //$NON-NLS-1$
            Messages.AbstractRepositorySettingsPage_CertificatePassword_, StringFieldEditor.UNLIMITED, certAuthComp) {
        @Override
        public int getNumberOfControls() {
            return 2;
        }
    };
    ((RepositoryStringFieldEditor) certAuthPasswordEditor).getTextControl().setEchoChar('*');

    saveCertPasswordButton = new Button(certAuthComp, SWT.CHECK);
    saveCertPasswordButton.setText(Messages.AbstractRepositorySettingsPage_Save_Password);

    certAuthFileNameEditor.setEnabled(certAuthButton.getSelection(), certAuthComp);
    certBrowseButton.setEnabled(certAuthButton.getSelection());
    certAuthPasswordEditor.setEnabled(certAuthButton.getSelection(), certAuthComp);
    saveCertPasswordButton.setEnabled(certAuthButton.getSelection());

    if (repository != null) {
        saveCertPasswordButton.setSelection(repository.getSavePassword(AuthenticationType.CERTIFICATE));
    } else {
        saveCertPasswordButton.setSelection(false);
    }
    setCertAuth(oldCertAuthPassword != null || oldCertAuthFileName != null);
    section.setExpanded(certAuthButton.getSelection());

    GridLayout gridLayout2 = new GridLayout();
    gridLayout2.numColumns = 3;
    gridLayout2.marginWidth = 0;
    certAuthComp.setLayout(gridLayout2);
}

From source file:org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositorySettingsPage.java

License:Open Source License

private void createHttpAuthSection() {
    ExpandableComposite section = createSection(innerComposite,
            Messages.AbstractRepositorySettingsPage_Http_Authentication);

    httpAuthComp = toolkit.createComposite(section, SWT.NONE);
    httpAuthComp.setBackground(compositeContainer.getBackground());
    section.setClient(httpAuthComp);/*  www  .ja  v  a 2s .  c  om*/

    httpAuthButton = new Button(httpAuthComp, SWT.CHECK);
    GridDataFactory.fillDefaults().indent(0, 5).align(SWT.LEFT, SWT.TOP).span(3, SWT.DEFAULT)
            .applyTo(httpAuthButton);

    httpAuthButton.setText(Messages.AbstractRepositorySettingsPage_Enable_http_authentication);

    httpAuthButton.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent e) {
            setHttpAuth(httpAuthButton.getSelection());
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            // ignore
        }
    });

    httpAuthUserNameEditor = new StringFieldEditor("", Messages.AbstractRepositorySettingsPage_User_ID_, //$NON-NLS-1$
            StringFieldEditor.UNLIMITED, httpAuthComp) {

        @Override
        protected boolean doCheckState() {
            return true;
        }

        @Override
        protected void valueChanged() {
            super.valueChanged();
            if (getWizard() != null) {
                getWizard().getContainer().updateButtons();
            }
        }

        @Override
        public int getNumberOfControls() {
            return 3;
        }
    };

    httpAuthPasswordEditor = new RepositoryStringFieldEditor("", //$NON-NLS-1$
            Messages.AbstractRepositorySettingsPage_Password_, StringFieldEditor.UNLIMITED, httpAuthComp) {
        @Override
        public int getNumberOfControls() {
            return 2;
        }
    };
    ((RepositoryStringFieldEditor) httpAuthPasswordEditor).getTextControl().setEchoChar('*');

    saveHttpPasswordButton = new Button(httpAuthComp, SWT.CHECK);
    saveHttpPasswordButton.setText(Messages.AbstractRepositorySettingsPage_Save_Password);

    httpAuthUserNameEditor.setEnabled(httpAuthButton.getSelection(), httpAuthComp);
    httpAuthPasswordEditor.setEnabled(httpAuthButton.getSelection(), httpAuthComp);
    saveHttpPasswordButton.setEnabled(httpAuthButton.getSelection());

    if (repository != null) {
        saveHttpPasswordButton.setSelection(repository.getSavePassword(AuthenticationType.HTTP));
    } else {
        saveHttpPasswordButton.setSelection(false);
    }
    setHttpAuth(oldHttpAuthPassword != null || oldHttpAuthUserId != null);
    section.setExpanded(httpAuthButton.getSelection());

    GridLayout gridLayout2 = new GridLayout();
    gridLayout2.numColumns = 3;
    gridLayout2.marginWidth = 0;
    httpAuthComp.setLayout(gridLayout2);
}

From source file:org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositorySettingsPage.java

License:Open Source License

private void createProxySection() {
    ExpandableComposite section = createSection(innerComposite,
            Messages.AbstractRepositorySettingsPage_Proxy_Server_Configuration);

    proxyAuthComp = toolkit.createComposite(section, SWT.NONE);
    GridLayout gridLayout2 = new GridLayout();
    gridLayout2.verticalSpacing = 0;//from www  .j  av  a 2s  .  c om
    gridLayout2.numColumns = 3;
    proxyAuthComp.setLayout(gridLayout2);
    proxyAuthComp.setBackground(compositeContainer.getBackground());
    section.setClient(proxyAuthComp);

    Composite systemSettingsComposite = new Composite(proxyAuthComp, SWT.NULL);
    GridLayout gridLayout3 = new GridLayout();
    gridLayout3.verticalSpacing = 0;
    gridLayout3.numColumns = 2;
    gridLayout3.marginWidth = 0;
    systemSettingsComposite.setLayout(gridLayout3);

    systemProxyButton = new Button(systemSettingsComposite, SWT.CHECK);
    GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.TOP).span(3, SWT.DEFAULT)
            .applyTo(systemSettingsComposite);

    systemProxyButton
            .setText(Messages.AbstractRepositorySettingsPage_Use_global_Network_Connections_preferences);

    systemProxyButton.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent e) {
            setUseDefaultProxy(systemProxyButton.getSelection());
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            // ignore
        }
    });

    changeProxySettingsLink = toolkit.createHyperlink(systemSettingsComposite,
            Messages.AbstractRepositorySettingsPage_Change_Settings, SWT.NULL);
    changeProxySettingsLink.setBackground(compositeContainer.getBackground());
    changeProxySettingsLink.addHyperlinkListener(new IHyperlinkListener() {

        public void linkActivated(HyperlinkEvent e) {
            PreferenceDialog dlg = PreferencesUtil.createPreferenceDialogOn(getShell(), PREFS_PAGE_ID_NET_PROXY,
                    new String[] { PREFS_PAGE_ID_NET_PROXY }, null);
            dlg.open();
        }

        public void linkEntered(HyperlinkEvent e) {
            // ignore
        }

        public void linkExited(HyperlinkEvent e) {
            // ignore
        }
    });

    proxyHostnameEditor = new StringFieldEditor("", Messages.AbstractRepositorySettingsPage_Proxy_host_address_, //$NON-NLS-1$
            StringFieldEditor.UNLIMITED, proxyAuthComp) {

        @Override
        protected boolean doCheckState() {
            return true;
        }

        @Override
        protected void valueChanged() {
            super.valueChanged();
            if (getWizard() != null) {
                getWizard().getContainer().updateButtons();
            }
        }

        @Override
        public int getNumberOfControls() {
            return 3;
        }
    };
    proxyHostnameEditor.setStringValue(oldProxyHostname);

    proxyPortEditor = new RepositoryStringFieldEditor("", //$NON-NLS-1$
            Messages.AbstractRepositorySettingsPage_Proxy_host_port_, StringFieldEditor.UNLIMITED, proxyAuthComp) {

        @Override
        protected boolean doCheckState() {
            return true;
        }

        @Override
        protected void valueChanged() {
            super.valueChanged();
            if (getWizard() != null) {
                getWizard().getContainer().updateButtons();
            }
        }

        @Override
        public int getNumberOfControls() {
            return 3;
        }
    };

    proxyPortEditor.setStringValue(oldProxyPort);

    proxyHostnameEditor.setEnabled(systemProxyButton.getSelection(), proxyAuthComp);
    proxyPortEditor.setEnabled(systemProxyButton.getSelection(), proxyAuthComp);

    // ************* PROXY AUTHENTICATION **************

    proxyAuthButton = new Button(proxyAuthComp, SWT.CHECK);
    GridDataFactory.fillDefaults().span(3, SWT.DEFAULT).applyTo(proxyAuthButton);
    proxyAuthButton.setText(Messages.AbstractRepositorySettingsPage_Enable_proxy_authentication);
    proxyAuthButton.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent e) {
            setProxyAuth(proxyAuthButton.getSelection());
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            // ignore
        }
    });

    proxyUserNameEditor = new StringFieldEditor("", Messages.AbstractRepositorySettingsPage_User_ID_, //$NON-NLS-1$
            StringFieldEditor.UNLIMITED, proxyAuthComp) {

        @Override
        protected boolean doCheckState() {
            return true;
        }

        @Override
        protected void valueChanged() {
            super.valueChanged();
            if (getWizard() != null) {
                getWizard().getContainer().updateButtons();
            }
        }

        @Override
        public int getNumberOfControls() {
            return 3;
        }
    };

    proxyPasswordEditor = new RepositoryStringFieldEditor("", Messages.AbstractRepositorySettingsPage_Password_, //$NON-NLS-1$
            StringFieldEditor.UNLIMITED, proxyAuthComp) {
        @Override
        public int getNumberOfControls() {
            return 2;
        }
    };
    ((RepositoryStringFieldEditor) proxyPasswordEditor).getTextControl().setEchoChar('*');

    // proxyPasswordEditor.setEnabled(httpAuthButton.getSelection(),
    // advancedComp);
    // ((StringFieldEditor)
    // httpAuthPasswordEditor).setEnabled(httpAuthButton.getSelection(),
    // advancedComp);

    // need to increase column number here, because above string editor will use them if declared beforehand
    ((GridLayout) (proxyAuthComp.getLayout())).numColumns++;
    saveProxyPasswordButton = new Button(proxyAuthComp, SWT.CHECK);
    saveProxyPasswordButton.setText(Messages.AbstractRepositorySettingsPage_Save_Password);
    saveProxyPasswordButton.setEnabled(proxyAuthButton.getSelection());

    if (repository != null) {
        saveProxyPasswordButton.setSelection(repository.getSavePassword(AuthenticationType.PROXY));
    } else {
        saveProxyPasswordButton.setSelection(false);
    }

    setProxyAuth(oldProxyUsername != null || oldProxyPassword != null);

    setUseDefaultProxy(repository != null ? repository.isDefaultProxyEnabled() : true);
    section.setExpanded(!systemProxyButton.getSelection());
}

From source file:org.eclipse.titan.executor.preferences.ExecutorPreferencePage.java

License:Open Source License

@Override
protected void createFieldEditors() {
    Composite parent = getFieldEditorParent();
    setLogFolder = new BooleanFieldEditor(PreferenceConstants.SET_LOG_FOLDER,
            PreferenceConstants.SET_LOG_FOLDER_LABEL, parent);
    addField(setLogFolder);/*from www  .j  av  a 2 s .com*/

    logFolderPath = new StringFieldEditor(PreferenceConstants.LOG_FOLDER_PATH_NAME,
            PreferenceConstants.LOG_FOLDER_PATH_LABEL, StringFieldEditor.UNLIMITED, parent);
    addField(logFolderPath);

    deleteLogFiles = new BooleanFieldEditor(PreferenceConstants.DELETE_LOG_FILES_NAME,
            PreferenceConstants.DELETE_LOG_FILES_LABEL, parent);
    addField(deleteLogFiles);

    automaticMerge = new BooleanFieldEditor(PreferenceConstants.AUTOMATIC_MERGE_NAME,
            PreferenceConstants.AUTOMATIC_MERGE_LABEL, parent);
    addField(automaticMerge);
}

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

License:Open Source License

@Override
protected void createFieldEditors() {

    IInformationPresenter presenter = new AbstractTooltipInformationPresenter() {
        @Override// www . j  a v  a  2 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(//from  w ww  .  ja  v  a 2  s .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.rdkit.knime.extensions.aggregration.RDKitMcsAggregationPreferencePage.java

License:Open Source License

/** {@inheritDoc} */
@Override//from ww  w .  j a v  a 2  s .c o m
protected void createFieldEditors() {
    m_editorThreshold = new StringFieldEditor(PREF_KEY_THRESHOLD, "Threshold (0.0 < t <= 1.0): ",
            StringFieldEditor.UNLIMITED, StringFieldEditor.VALIDATE_ON_KEY_STROKE, getFieldEditorParent());
    addField(m_editorThreshold);

    m_editorRingMatchesRingOnlyOption = new BooleanFieldEditor(PREF_KEY_RING_MATCHES_RING_ONLY_OPTION,
            "Ring matches ring only", getFieldEditorParent());
    addField(m_editorRingMatchesRingOnlyOption);

    m_editorCompleteRingsOnlyOption = new BooleanFieldEditor(PREF_KEY_COMPLETE_RINGS_ONLY_OPTION,
            "Complete rings only", getFieldEditorParent());
    addField(m_editorCompleteRingsOnlyOption);

    m_editorMatchValencesOption = new BooleanFieldEditor(PREF_KEY_MATCH_VALENCES_OPTION, "Match valences",
            getFieldEditorParent());
    addField(m_editorMatchValencesOption);

    final String[][] arrAtomComparisons = new String[AtomComparison.values().length][2];
    int i = 0;
    for (final AtomComparison comp : AtomComparison.values()) {
        arrAtomComparisons[i][0] = comp.toString();
        arrAtomComparisons[i][1] = comp.name();
        i++;
    }
    m_editorAtomComparison = new ComboFieldEditor(PREF_KEY_ATOM_COMPARISON, "Atom comparison: ",
            arrAtomComparisons, getFieldEditorParent());
    addField(m_editorAtomComparison);

    final String[][] arrBondComparisons = new String[BondComparison.values().length][2];
    i = 0;
    for (final BondComparison comp : BondComparison.values()) {
        arrBondComparisons[i][0] = comp.toString();
        arrBondComparisons[i][1] = comp.name();
        i++;
    }
    m_editorBondComparison = new ComboFieldEditor(PREF_KEY_BOND_COMPARISON, "Bond comparison: ",
            arrBondComparisons, getFieldEditorParent());
    addField(m_editorBondComparison);

    m_editorTimeout = new IntegerFieldEditor(PREF_KEY_TIMEOUT, "Timeout (in seconds): ",
            getFieldEditorParent());
    m_editorTimeout.setValidRange(1, Integer.MAX_VALUE);
    ;
    addField(m_editorTimeout);
}

From source file:org.soyatec.tooling.gef.properties.ViewPropertyTab.java

License:Open Source License

private FieldEditor createFieldEditor(final Composite parent, final EStructuralFeature feature) {
    final String name = feature.getName();
    final String label = getFeatureLabel(feature);
    if (ES_BACKGROUND == feature || ES_FOREGROUND == feature || ES_GRADIENT_COLOR == feature
            || ES_LINE_COLOR == feature) {
        return new ColorFieldEditor(name, label, parent);
    } else if (ES_GRADIENT_VERTICAL == feature) {
        return new ComboFieldEditor(name, label,
                new String[][] { { ResourcesFactory.getString("properties_vertical"), "true" }, //$NON-NLS-1$//$NON-NLS-2$
                        { ResourcesFactory.getString("properties_horizontal"), "false" } }, //$NON-NLS-1$//$NON-NLS-2$
                parent);/*  w ww.  j a  v  a2 s.  co m*/
    } else {
        final Class<?> instanceClass = feature.getEType().getInstanceClass();
        if (boolean.class == instanceClass) {
            return new BooleanFieldEditor(name, label, parent);
        } else if (int.class == instanceClass) {
            return new SpinnerFieldEditor(name, label, parent, 1, 10, 1, 1);
        }
    }
    return new StringFieldEditor(name, label, StringFieldEditor.UNLIMITED,
            StringFieldEditor.VALIDATE_ON_KEY_STROKE, parent);
}