Example usage for org.eclipse.jface.preference StringButtonFieldEditor setChangeButtonText

List of usage examples for org.eclipse.jface.preference StringButtonFieldEditor setChangeButtonText

Introduction

In this page you can find the example usage for org.eclipse.jface.preference StringButtonFieldEditor setChangeButtonText.

Prototype

public void setChangeButtonText(String text) 

Source Link

Document

Sets the text of the change button.

Usage

From source file:com.technophobia.substeps.editor.preferences.page.SubstepsPropertyPage.java

License:Open Source License

private FieldEditor createStringFieldEditor(final SubstepsPreferences preference, final String label,
        final Group group) {
    final StringButtonFieldEditor fieldEditor = new StringButtonFieldEditor(preference.key(), label, group) {

        @Override//  ww  w  .j a  v a  2  s.  com
        protected String changePressed() {
            final String newLocation = handleBrowseFolderClick();
            return newLocation != null ? newLocation : "";
        }
    };
    fieldEditor.setChangeButtonText("Browse");
    fieldEditor.setPage(this);
    fieldEditor.setPreferenceStore(getPreferenceStore());
    fieldEditor.load();
    return fieldEditor;
}

From source file:it.unibz.instasearch.prefs.InstaSearchPreferencePage.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  w w  . j  a v a  2  s . co  m*/
 */
@Override
public void createFieldEditors() {

    String[] fileValues = new String[] { "5", "10", "15", "25", "50" };
    addField(new ComboFieldEditor(PreferenceConstants.P_SHOWN_FILES_COUNT, "Shown results (initially)",
            getArrayOfPairs(fileValues), getFieldEditorParent()));

    String[] lineValues = new String[] { "3", "4", "5", "7", "10", "15", "25" };
    addField(new ComboFieldEditor(PreferenceConstants.P_SHOWN_LINES_COUNT, "Preview lines",
            getArrayOfPairs(lineValues), getFieldEditorParent()));

    addBoolField(PreferenceConstants.P_SHOW_MATCH_COUNT, "Show number of matches");

    addBoolField(PreferenceConstants.P_SHOW_FULL_PATH, "Show full file path in results");

    addBoolField(PreferenceConstants.P_DIALOG_ON_SHORTCUT, "Open search dialog with shortcut key (Ctrl+Alt+I)");

    StringButtonFieldEditor extensions = new ExtensionsFieldEditor(getFieldEditorParent());
    extensions.setChangeButtonText("...");
    extensions.setEmptyStringAllowed(true);
    addField(extensions);

    addBoolField(PreferenceConstants.P_INDEX_EMPTY_EXTENSION, "Index files without extension");

    BooleanFieldEditor indexJars = new BooleanFieldEditor(PreferenceConstants.P_INDEX_ARCHIVES,
            "Index JAR Source Attachements (beta)", getFieldEditorParent());
    addField(indexJars);
    indexJars.setEnabled(false, getFieldEditorParent());

    if (InstaSearchPlugin.getInstaSearch() != null
            && InstaSearchPlugin.getInstaSearch().getIndexer() instanceof WorkspaceIndexerJDT)
        indexJars.setEnabled(true, getFieldEditorParent());

    addBoolField(PreferenceConstants.P_FUZZY_SEARCH_AUTO, "Find similar matches when no exact matches found");

    String version = InstaSearchPlugin.getVersion();
    addBoolField(PreferenceConstants.P_CHECK_UPDATES, "Notify about updates (ver. " + version + ")");

    periodicReindexEnabled = addBoolField(PreferenceConstants.P_INDEX_UPDATE_ENABLED,
            "Enable Automatic-Reindex");
    periodicReindexInterval = new IntegerFieldEditor(PreferenceConstants.P_INDEX_UPDATE_INTERVAL,
            "Automatic Reindex interval", getFieldEditorParent());
    periodicReindexInterval.setValidRange(0, Integer.MAX_VALUE);
    addField(periodicReindexInterval);

    addField(new WorkspacePathEditor(PreferenceConstants.P_EXCLUDE_DIRS, "Exclude folders from index",
            "Select folder to exclude from indexing", getFieldEditorParent()));
    //new Label(getFieldEditorParent(), SWT.NONE).setText("Note: Folders with Derived flag are excluded");

    Link annotationsLink = new Link(getFieldEditorParent(), SWT.NONE);
    annotationsLink.setText("See <a>Annotations</a> to set Search Results highlight color");
    annotationsLink.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            PreferencesUtil.createPreferenceDialogOn(getShell(),
                    "org.eclipse.ui.editors.preferencePages.Annotations", null, null).open();
        }
    });
}