KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > freemarker > eclipse > preferences > EditorPreferencePage


1 package freemarker.eclipse.preferences;
2
3 import org.eclipse.jface.preference.BooleanFieldEditor;
4 import org.eclipse.jface.preference.ColorFieldEditor;
5 import org.eclipse.jface.preference.FieldEditorPreferencePage;
6 import org.eclipse.ui.IWorkbench;
7 import org.eclipse.ui.IWorkbenchPreferencePage;
8
9 import freemarker.eclipse.FreemarkerPlugin;
10
11 /**
12  * This class represents a preference page that
13  * is contributed to the Preferences dialog. By
14  * subclassing <samp>FieldEditorPreferencePage</samp>, we
15  * can use the field support built into JFace that allows
16  * us to create a page that is small and knows how to
17  * save, restore and apply itself.
18  * <p>
19  * This page is used to modify preferences only. They
20  * are stored in the preference store that belongs to
21  * the main plug-in class. That way, preferences can
22  * be accessed directly via the preference store.
23  */

24
25 public class EditorPreferencePage
26     extends FieldEditorPreferencePage
27     implements IWorkbenchPreferencePage, IPreferenceConstants {
28     
29     public EditorPreferencePage() {
30         super(GRID);
31         setPreferenceStore(FreemarkerPlugin.getDefault().getPreferenceStore());
32         setDescription("Highlighting Settings");
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
42     public void createFieldEditors() {
43         
44         addField(new ColorFieldEditor(COLOR_DIRECTIVE,
45                 "Directive:", getFieldEditorParent()));
46         addField(new ColorFieldEditor(COLOR_INTERPOLATION,
47                 "Interpolation:", getFieldEditorParent()));
48         addField(new ColorFieldEditor(COLOR_TEXT,
49                 "Text:", getFieldEditorParent()));
50         addField(new ColorFieldEditor(COLOR_COMMENT,
51                 "Comment:", getFieldEditorParent()));
52         addField(new ColorFieldEditor(COLOR_STRING,
53                 "String:", getFieldEditorParent()));
54         addField(new BooleanFieldEditor(XML_HIGHLIGHTING,
55                 "HTML/XML Highlighting", getFieldEditorParent()));
56         addField(new ColorFieldEditor(COLOR_XML_TAG,
57                 "HTML/XML Tag:", getFieldEditorParent()));
58         addField(new ColorFieldEditor(COLOR_XML_COMMENT,
59                 "HTML/XML Comment:", getFieldEditorParent()));
60     }
61     
62     public void init(IWorkbench workbench) {
63     }
64 }
Popular Tags