01: package net.refractions.udig.ui.preferences;
02:
03: import net.refractions.udig.internal.ui.UiPlugin;
04: import net.refractions.udig.ui.internal.Messages;
05:
06: import org.eclipse.core.runtime.Platform;
07: import org.eclipse.jface.preference.BooleanFieldEditor;
08: import org.eclipse.jface.preference.FieldEditorPreferencePage;
09: import org.eclipse.ui.IWorkbench;
10: import org.eclipse.ui.IWorkbenchPreferencePage;
11:
12: /**
13: * This class represents a preference page that is contributed to the
14: * Preferences dialog. By subclassing <samp>FieldEditorPreferencePage</samp>,
15: * we can use the field support built into JFace that allows us to create a page
16: * that is small and knows how to save, restore and apply itself.
17: * <p>
18: * This page is used to modify preferences only. They are stored in the
19: * preference store that belongs to the main plug-in class. That way,
20: * preferences can be accessed directly via the preference store.
21: */
22:
23: public class UiPreferences extends FieldEditorPreferencePage implements
24: IWorkbenchPreferencePage {
25:
26: public UiPreferences() {
27: super (GRID);
28: setPreferenceStore(UiPlugin.getDefault().getPreferenceStore());
29: setDescription(Messages.UiPreferences_description);
30: }
31:
32: /**
33: * Creates the field editors. Field editors are abstractions of the common
34: * GUI blocks needed to manipulate various types of preferences. Each field
35: * editor knows how to save and restore itself.
36: */
37: public void createFieldEditors() {
38:
39: if (Platform.getOS().equals(Platform.OS_LINUX)) {
40: addField(new BooleanFieldEditor(
41: net.refractions.udig.ui.preferences.PreferenceConstants.P_ADVANCED_GRAPHICS,
42: Messages.UiPreferences_advancedGraphics_label,
43: getFieldEditorParent()));
44: }
45:
46: }
47:
48: /*
49: * (non-Javadoc)
50: *
51: * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
52: */
53: public void init(IWorkbench workbench) {
54: }
55:
56: }
|