1 package org.hibernate.eclipse.console.preferences; 2 3 import org.eclipse.jface.preference.*; 4 import org.eclipse.ui.IWorkbenchPreferencePage; 5 import org.eclipse.ui.IWorkbench; 6 import org.hibernate.eclipse.console.HibernateConsolePlugin; 7 import org.eclipse.jface.preference.IPreferenceStore; 8 9 22 23 24 public class HibernateConsolePreferencePage 25 extends FieldEditorPreferencePage 26 implements IWorkbenchPreferencePage { 27 public static final String P_PATH = "pathPreference"; 28 public static final String P_BOOLEAN = "booleanPreference"; 29 public static final String P_CHOICE = "choicePreference"; 30 public static final String P_STRING = "stringPreference"; 31 32 public HibernateConsolePreferencePage() { 33 super(GRID); 34 setPreferenceStore(HibernateConsolePlugin.getDefault().getPreferenceStore()); 35 setDescription("A demonstration of a preference page implementation"); 36 initializeDefaults(); 37 } 38 41 private void initializeDefaults() { 42 IPreferenceStore store = getPreferenceStore(); 43 store.setDefault(P_BOOLEAN, true); 44 store.setDefault(P_CHOICE, "choice2"); 45 store.setDefault(P_STRING, "Default value"); 46 } 47 48 54 55 public void createFieldEditors() { 56 addField(new DirectoryFieldEditor(P_PATH, 57 "&Directory preference:", getFieldEditorParent())); 58 addField( 59 new BooleanFieldEditor( 60 P_BOOLEAN, 61 "&An example of a boolean preference", 62 getFieldEditorParent())); 63 64 addField(new RadioGroupFieldEditor( 65 P_CHOICE, 66 "An example of a multiple-choice preference", 67 1, 68 new String [][] { { "&Choice 1", "choice1" }, { 69 "C&hoice 2", "choice2" } 70 }, getFieldEditorParent())); 71 addField( 72 new StringFieldEditor(P_STRING, "A &text preference:", getFieldEditorParent())); 73 } 74 75 public void init(IWorkbench workbench) { 76 } 77 } | Popular Tags |