Example usage for org.eclipse.jface.preference PathEditor PathEditor

List of usage examples for org.eclipse.jface.preference PathEditor PathEditor

Introduction

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

Prototype

public PathEditor(String name, String labelText, String dirChooserLabelText, Composite parent) 

Source Link

Document

Creates a path field editor.

Usage

From source file:net.sourceforge.texlipse.properties.BibDirectoriesPreferencePage.java

License:Open Source License

/**
 * Creates the property editing UI components of this page.
 *//*from www.j a  v a 2  s  . c o  m*/
protected void createFieldEditors() {
    Composite parent = getFieldEditorParent();
    PathEditor dir = new PathEditor(TexlipseProperties.BIB_DIR,
            TexlipsePlugin.getResourceString("preferenceBibDirLabel"), "", parent);
    addField(dir);
    dir.getButtonBoxControl(parent).setToolTipText(TexlipsePlugin.getResourceString("preferenceBibDirTooltip"));
    dir.getLabelControl(parent).setToolTipText(TexlipsePlugin.getResourceString("preferenceBibDirTooltip"));
    dir.getListControl(parent).setToolTipText(TexlipsePlugin.getResourceString("preferenceBibDirTooltip"));
}

From source file:no.resheim.elibrarium.epub.ui.preferences.ScanPreferencePage.java

License:Open Source License

@Override
public void createFieldEditors() {
    addField(new BooleanFieldEditor(PreferenceConstants.SCAN_ENABLE, "&Scan folders for EPUB files",
            getFieldEditorParent()));/*from  w  w  w  .ja  v a  2  s  . com*/
    // Add group for scan details
    Group group = new Group(getFieldEditorParent(), SWT.NONE);
    group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    group.setText("Folder scanning:");

    IntegerFieldEditor intervalEditor = new IntegerFieldEditor(PreferenceConstants.SCAN_INTERVAL,
            "Minutes between scans:", group);
    addField(intervalEditor);

    PathEditor pathEditor = new PathEditor(PreferenceConstants.SCAN_FOLDERS, "Scanned folders",
            "Select a folder to scan", group);
    addField(pathEditor);

    ((GridLayout) group.getLayout()).marginLeft = 5;
    ((GridLayout) group.getLayout()).marginRight = 5;
    ((GridLayout) group.getLayout()).marginTop = 5;
    ((GridLayout) group.getLayout()).marginBottom = 5;
}

From source file:org.eclipse.buckminster.ui.prefs.DynamicPreferencePage.java

License:Open Source License

protected void addDynamicFieldEditors(Composite parent, String nodeName, IPreferenceDescriptor[] descriptors) {
    final IPreferenceStore nodePrefs = UiPlugin.getDefault().getBuckminsterPreferenceStore(nodeName);
    for (final IPreferenceDescriptor descriptor : descriptors) {
        String name = descriptor.getName();
        String label = descriptor.getLabel();
        IPreferenceValidator descValidator = descriptor.getValidator();
        if (descValidator == null)
            descValidator = nullValidator;
        final IPreferenceValidator validator = descValidator;
        FieldEditor editor;/*from  ww  w  .j a  va2s  .  c o m*/
        switch (descriptor.getType()) {
        case Boolean:
            editor = new BooleanFieldEditor(name, label, parent) {
                @Override
                public IPreferenceStore getPreferenceStore() {
                    return nodePrefs;
                }
            };
            break;
        case Directory:
            editor = new DirectoryFieldEditor(name, label, parent) {
                @Override
                public IPreferenceStore getPreferenceStore() {
                    return nodePrefs;
                }

                @Override
                protected boolean checkState() {
                    return super.checkState() && validator.validate(UiUtils.trimmedValue(getTextControl()));
                }
            };
            break;
        case Enum:
            Enum<?>[] enums = descriptor.getEnums();
            int idx = enums.length;
            String[][] labelsAndValues = new String[idx][2];
            while (--idx >= 0) {
                labelsAndValues[idx][0] = enums[idx].toString();
                labelsAndValues[idx][1] = enums[idx].name();
            }
            editor = new RadioGroupFieldEditor(name, label, 1, labelsAndValues, parent) {
                @Override
                public IPreferenceStore getPreferenceStore() {
                    return nodePrefs;
                }
            };
            break;
        case File:
            editor = new FileFieldEditor(name, label, parent) {
                @Override
                public IPreferenceStore getPreferenceStore() {
                    return nodePrefs;
                }

                @Override
                protected boolean checkState() {
                    return super.checkState() && validator.validate(UiUtils.trimmedValue(getTextControl()));
                }
            };
            break;
        case Integer:
            editor = new IntegerFieldEditor(name, label, parent, descriptor.getTextWidth()) {
                @Override
                public IPreferenceStore getPreferenceStore() {
                    return nodePrefs;
                }

                @Override
                protected boolean checkState() {
                    return super.checkState() && validator.validate(UiUtils.trimmedValue(getTextControl()));
                }
            };
            int[] range = descriptor.getIntegerRange();
            if (range != null)
                ((IntegerFieldEditor) editor).setValidRange(range[0], range[1]);
            break;
        case Path:
            editor = new PathEditor(name, label, label, parent) {
                @Override
                public IPreferenceStore getPreferenceStore() {
                    return nodePrefs;
                }
            };
            break;
        case Password:
            editor = new PasswordFieldEditor(name, label, descriptor.getTextWidth(), parent, nodeName) {
                @Override
                public IPreferenceStore getPreferenceStore() {
                    return nodePrefs;
                }

                @Override
                protected boolean checkState() {
                    return validator.validate(UiUtils.trimmedValue(getTextControl()));
                }
            };
            break;
        default:
            editor = new StringFieldEditor(name, label, descriptor.getTextWidth(), parent) {
                @Override
                public IPreferenceStore getPreferenceStore() {
                    return nodePrefs;
                }

                @Override
                protected boolean checkState() {
                    return validator.validate(UiUtils.trimmedValue(getTextControl()));
                }
            };
        }
        addField(editor);
    }
}

From source file:org.eclipse.cdt.make.internal.ui.preferences.MakefileSettingsPreferencePage.java

License:Open Source License

/**
 * @see FieldEditorPreferencePage#createControl(Composite)
 *///from ww  w . j a v  a 2  s.  c  o m
@Override
protected void createFieldEditors() {
    String[][] personalities = { { POSIX_MAKE_LABEL, POSIX_MAKE_VALUE }, { GNU_MAKE_LABEL, GNU_MAKE_VALUE } };
    RadioGroupFieldEditor combo = new RadioGroupFieldEditor(MakeCorePlugin.MAKEFILE_STYLE,
            MakefilePreferencesMessages.getString("MakefileSettingsPreferencePage.style"), //$NON-NLS-1$
            2, personalities, getFieldEditorParent());
    addField(combo);

    PathEditor pathEditor = new PathEditor(MakeCorePlugin.MAKEFILE_DIRS,
            MakefilePreferencesMessages.getString("MakefileSettingsPreferencePage.path.label"), //$NON-NLS-1$
            MakefilePreferencesMessages.getString("MakefileSettingsPreferencePage.path.browse"), //$NON-NLS-1$
            getFieldEditorParent());
    addField(pathEditor);
}

From source file:org.eclipse.ease.lang.python.jython.preferences.PythonLibraryPreferencePage.java

License:Open Source License

@Override
protected void createFieldEditors() {
    addField(new PathEditor(IPreferenceConstants.PYTHON_LIBRARIES, "External library location",
            "Select a folder for an external library", parent));
}

From source file:org.eclipse.eclipsemonkey.lang.python.PythonLibraryPreferencePage.java

License:Open Source License

@Override
protected void createFieldEditors() {
    addField(new PathEditor(IPreferenceConstants.PYTHON_LIBRARIES, "tatr", "dqdqd", parent));
}

From source file:org.eclipse.jet.internal.ui.prefs.JETPreferencePage.java

License:Open Source License

protected void createFieldEditors() {
    if (element != null) {
        setPreferenceStore(/*from  w ww.j av a 2  s.c  om*/
                new ScopedPreferenceStore(new ProjectScope((IProject) element), JET2Platform.PLUGIN_ID));
    } else {
        setPreferenceStore(new ScopedPreferenceStore(new InstanceScope(), JET2Platform.PLUGIN_ID));
    }
    addField(new PathEditor(JETPreferences.ADDITIONAL_TEMPLATE_JAR_LOCATIONS,
            Messages.JETPreferencePage_LocationsLabel, Messages.JETPreferencePage_LocationsAddDialogTitle,
            getFieldEditorParent()));
}

From source file:org.eclipse.linuxtools.internal.systemtap.ui.ide.preferences.TapsetsPreferencePage.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  va 2  s  .  c om*/
 */
@Override
public void createFieldEditors() {
    addField(new PathEditor(IDEPreferenceConstants.P_TAPSETS,
            Localization.getString("TapsetsPreferencePage.AdditionalTapsets"), //$NON-NLS-1$
            Localization.getString("TapsetsPreferencePage.TapsetDirectory"), getFieldEditorParent())); //$NON-NLS-1$
}

From source file:org.eclipse.linuxtools.systemtap.ui.dashboard.preferences.DashboardPreferencePage.java

License:Open Source License

public void createFieldEditors() {
    LogManager.logDebug("Start createFieldEditors:", this);
    addField(new PathEditor(DashboardPreferenceConstants.P_MODULE_FOLDERS,
            Localization.getString("DashboardPreferencePage.AdditionalDirectories"),
            Localization.getString("DashboardPreferencePage.ModuleDirectory"), getFieldEditorParent()));

    addField(new IntegerFieldEditor(DashboardPreferenceConstants.P_DASHBOARD_UPDATE_DELAY,
            Localization.getString("DashboardPreferencePage.RefreshDelay"), getFieldEditorParent()));

    addField(new StringFieldEditor(DashboardPreferenceConstants.P_DASHBOARD_EXAMPLES_DIR,
            Localization.getString("DashboardPreferencePage.ExamplesDir"), getFieldEditorParent()));

    LogManager.logDebug("End createFieldEditors:", this);
}

From source file:org.eclipse.linuxtools.systemtap.ui.ide.preferences.TapsetsPreferencePage.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 .  j  a v a  2s .c o m*/
 */
public void createFieldEditors() {
    LogManager.logDebug("Start createFieldEditors:", this);
    addField(new PathEditor(IDEPreferenceConstants.P_TAPSETS,
            Localization.getString("TapsetsPreferencePage.AdditionalTapsets"),
            Localization.getString("TapsetsPreferencePage.TapsetDirectory"), getFieldEditorParent()));
    LogManager.logDebug("End createFieldEditors:", this);
}