plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/preferences/WrtEditingPreferencePage.java
changeset 484 f5df819c1852
parent 470 d4809db37847
equal deleted inserted replaced
483:109da596fa9d 484:f5df819c1852
    11 import org.symbian.tools.tmw.previewer.IWrtEditingPreferences;
    11 import org.symbian.tools.tmw.previewer.IWrtEditingPreferences;
    12 import org.symbian.tools.tmw.previewer.PreviewerPlugin;
    12 import org.symbian.tools.tmw.previewer.PreviewerPlugin;
    13 
    13 
    14 /**
    14 /**
    15  * This class represents a preference page that
    15  * This class represents a preference page that
    16  * is contributed to the Preferences dialog. By 
    16  * is contributed to the Preferences dialog. By
    17  * subclassing <samp>FieldEditorPreferencePage</samp>, we
    17  * subclassing <samp>FieldEditorPreferencePage</samp>, we
    18  * can use the field support built into JFace that allows
    18  * can use the field support built into JFace that allows
    19  * us to create a page that is small and knows how to 
    19  * us to create a page that is small and knows how to
    20  * save, restore and apply itself.
    20  * save, restore and apply itself.
    21  * <p>
    21  * <p>
    22  * This page is used to modify preferences only. They
    22  * This page is used to modify preferences only. They
    23  * are stored in the preference store that belongs to
    23  * are stored in the preference store that belongs to
    24  * the main plug-in class. That way, preferences can
    24  * the main plug-in class. That way, preferences can
    25  * be accessed directly via the preference store.
    25  * be accessed directly via the preference store.
    26  */
    26  */
    27 
    27 
    28 public class WrtEditingPreferencePage
    28 public class WrtEditingPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
    29 	extends FieldEditorPreferencePage
       
    30 	implements IWorkbenchPreferencePage {
       
    31 
    29 
    32 	private RadioGroupFieldEditor enableAutorefresh;
    30     private RadioGroupFieldEditor enableAutorefresh;
    33 
    31 
    34 	public WrtEditingPreferencePage() {
    32     public WrtEditingPreferencePage() {
    35 		super(GRID);
    33         super(GRID);
    36 		setPreferenceStore(PreviewerPlugin.getDefault().getPreferenceStore());
    34         setPreferenceStore(PreviewerPlugin.getDefault().getPreferenceStore());
    37 	}
    35     }
    38 	
    36 
    39 	/**
    37     /**
    40 	 * Creates the field editors. Field editors are abstractions of
    38      * Creates the field editors. Field editors are abstractions of
    41 	 * the common GUI blocks needed to manipulate various types
    39      * the common GUI blocks needed to manipulate various types
    42 	 * of preferences. Each field editor knows how to save and
    40      * of preferences. Each field editor knows how to save and
    43 	 * restore itself.
    41      * restore itself.
    44 	 */
    42      */
    45 	public void createFieldEditors() {
    43     public void createFieldEditors() {
    46         Composite projectComposite = new Composite(getFieldEditorParent(), SWT.NONE);
    44         Composite projectComposite = new Composite(getFieldEditorParent(), SWT.NONE);
    47         projectComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    45         projectComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    48         projectComposite.setFont(getFieldEditorParent().getFont());
    46         projectComposite.setFont(getFieldEditorParent().getFont());
    49 
    47 
    50 		String[][] namesAndValues = {
    48         String[][] namesAndValues = { { "Enabled", MessageDialogWithToggle.ALWAYS },
    51 				{ "Enabled", MessageDialogWithToggle.ALWAYS },
    49                 { "Disabled", MessageDialogWithToggle.NEVER }, { "Prompt", MessageDialogWithToggle.PROMPT } };
    52 				{ "Disabled", MessageDialogWithToggle.NEVER },
    50         enableAutorefresh = new RadioGroupFieldEditor(IWrtEditingPreferences.PREF_AUTO_REFRESH,
    53 				{ "Prompt", MessageDialogWithToggle.PROMPT } };
    51                 "Initial auto-refresh setting for Mobile Web Preview window", namesAndValues.length, namesAndValues,
    54 		enableAutorefresh = new RadioGroupFieldEditor(
    52                 projectComposite, true);
    55 				IWrtEditingPreferences.PREF_AUTO_REFRESH,
    53         enableAutorefresh.setPreferenceStore(getPreferenceStore());
    56 				"Initial auto-refresh setting for Mobile Web Preview window",
    54         enableAutorefresh.setPage(this);
    57 				namesAndValues.length, namesAndValues, projectComposite, true);
    55         enableAutorefresh.load();
    58 		enableAutorefresh.setPreferenceStore(getPreferenceStore());
       
    59 		enableAutorefresh.setPage(this);
       
    60 		enableAutorefresh.load();
       
    61         addField(enableAutorefresh);
    56         addField(enableAutorefresh);
    62 	}
    57     }
    63 
    58 
    64 	/* (non-Javadoc)
    59     /* (non-Javadoc)
    65 	 * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
    60      * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
    66 	 */
    61      */
    67 	public void init(IWorkbench workbench) {
    62     public void init(IWorkbench workbench) {
    68 	}
    63     }
    69 
       
    70 //	@Override
       
    71 //	protected void performDefaults() {
       
    72 //		enableAutorefresh.loadDefault();
       
    73 //		super.performDefaults();
       
    74 //	}
       
    75 //	
       
    76 //	@Override
       
    77 //	public boolean performOk() {
       
    78 //		enableAutorefresh.store();
       
    79 //		return super.performOk();
       
    80 //	}
       
    81 }
    64 }