Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/port80/eclipse/editors/preferences/MakefileEditorPreferencePage.java


1   package com.port80.eclipse.editors.preferences;
2   
3   import org.eclipse.jface.preference.BooleanFieldEditor;
4   import org.eclipse.jface.preference.FieldEditorPreferencePage;
5   import org.eclipse.jface.preference.IntegerFieldEditor;
6   import org.eclipse.ui.IWorkbench;
7   import org.eclipse.ui.IWorkbenchPreferencePage;
8   
9   import com.port80.eclipse.editors.EditorsPlugin;
10  import com.port80.eclipse.editors.IConstants;
11  import com.port80.eclipse.util.*;
12  import com.port80.eclipse.util.SeparatorFieldEditor;
13  
14  /**
15   * This class represents a preference page that
16   * is contributed to the Preferences dialog. By 
17   * subclassing <samp>FieldEditorPreferencePage</samp>, we
18   * can use the field support built into JFace that allows
19   * us to create a page that is small and knows how to 
20   * save, restore and apply itself.
21   * <p>
22   * This page is used to modify preferences only. They
23   * are stored in the preference store that belongs to
24   * the main plug-in class. That way, preferences can
25   * be accessed directly via the preference store.
26   */
27  
28  public class MakefileEditorPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage, IConstants {
29  
30    ////////////////////////////////////////////////////////////////////////
31  
32    private static final String NAME="MakefileEditorPreferencePage";
33    
34    ////////////////////////////////////////////////////////////////////////
35  
36    public MakefileEditorPreferencePage() {
37      super(GRID);
38      setPreferenceStore(EditorsPlugin.getDefault().getPreferenceStore());
39      // setDescription(EditorsPlugin.getResourceString(NAME+".description"));
40      initializeDefaults();
41    }
42  
43    ////////////////////////////////////////////////////////////////////////
44  
45    /**
46     * Sets the default values of the preferences.
47     */
48    private void initializeDefaults() {
49      getPreferenceStore();
50    }
51  
52    /**
53     * Creates the field editors. Field editors are abstractions of
54     * the common GUI blocks needed to manipulate various types
55     * of preferences. Each field editor knows how to save and
56     * restore itself.
57     */
58  
59    public void createFieldEditors() {
60      String linewidth=EditorsPlugin.getResourceString("LineWidth");
61      String tabwidth=EditorsPlugin.getResourceString("TabWidth");
62      String background=EditorsPlugin.getResourceString("Background");
63      String font=EditorsPlugin.getResourceString("Font");
64      String skip=EditorsPlugin.getResourceString("SkipUpperCaseVar");
65      String sync=EditorsPlugin.getResourceString("SyncSelection");
66      String validate=EditorsPlugin.getResourceString("ValidateAfterAction");
67      //
68      addField(new IntegerFieldEditor(PREF_MAKEFILE_LINEWIDTH, linewidth, getFieldEditorParent()));
69      addField(new IntegerFieldEditor(PREF_MAKEFILE_TABWIDTH, tabwidth, getFieldEditorParent()));
70      addField(new HexColorFieldEditor(PREF_MAKEFILE_BG, background,getFieldEditorParent()));
71      addField(new CustomFontFieldEditor(PREF_MAKEFILE_FONT, font, getFieldEditorParent()));
72      addField(new SeparatorFieldEditor("", "", getFieldEditorParent()));
73      addField(new BooleanFieldEditor(PREF_MAKEFILE_SKIP_UPPERCASE_VAR, skip, getFieldEditorParent()));
74      addField(new BooleanFieldEditor(PREF_MAKEFILE_VALIDATE_AFTER_ACTION, validate, getFieldEditorParent()));
75      addField(new SeparatorFieldEditor("", "", getFieldEditorParent()));
76      addField(new BooleanFieldEditor(PREF_MAKEFILE_SYNC_SELECTION, sync, getFieldEditorParent()));
77      addField(new SeparatorFieldEditor("", "", getFieldEditorParent()));
78    }
79  
80    public void init(IWorkbench workbench) {
81    }
82  }