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