RSS news reader; initially copied from "all the news"
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.news / src / net / sourceforge / phpeclipse / news / pref / PreferencePage.java
1 package net.sourceforge.phpeclipse.news.pref;
2
3 import net.sourceforge.phpeclipse.news.Plugin;
4
5 import org.eclipse.jface.preference.BooleanFieldEditor;
6 import org.eclipse.jface.preference.FieldEditorPreferencePage;
7 import org.eclipse.jface.preference.FileFieldEditor;
8 import org.eclipse.jface.preference.IntegerFieldEditor;
9 import org.eclipse.ui.IWorkbench;
10 import org.eclipse.ui.IWorkbenchPreferencePage;
11
12 public class PreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
13
14     protected SiteListEditor siteListFE;
15     protected BanListEditor banListFE;
16     protected FileFieldEditor browserAppFE;
17     protected IntegerFieldEditor refreshFE;
18     protected BooleanFieldEditor forceCacheFE;
19
20     public PreferencePage() {
21         super("All The News", FieldEditorPreferencePage.GRID);
22     }
23
24     /**
25      * @see FieldEditorPreferencePage#createFieldEditors()
26      */
27     protected void createFieldEditors() {
28         siteListFE = new SiteListEditor(Plugin.BACKENDS_PREFERENCE, "Sites", getFieldEditorParent());
29         banListFE = new BanListEditor(Plugin.BANNED_ITEMS_PREFERENCE, "Banned items", getFieldEditorParent());
30         browserAppFE = new FileFieldEditor(Plugin.BROWSER_PREFERENCE, "External Browser", getFieldEditorParent());
31         refreshFE = new IntegerFieldEditor(Plugin.REFRESH_INTERVAL_PREFERENCE,"Refresh interval (minutes)", getFieldEditorParent());
32         refreshFE.setValidRange(0,10000);
33
34         forceCacheFE = new BooleanFieldEditor(Plugin.FORCE_CACHE_PREFERENCE,"Force refresh from proxy", getFieldEditorParent());
35
36         addField(siteListFE);
37         addField(banListFE);
38         addField(browserAppFE);
39         addField(refreshFE);
40         addField(forceCacheFE);
41     }
42
43     /**
44      * @see IWorkbenchPreferencePage#init(IWorkbench)
45      */
46     public void init(IWorkbench workbench) {
47         setPreferenceStore(Plugin.getDefault().getPreferenceStore());
48     }
49
50     /**
51      * @see org.eclipse.jface.preference.IPreferencePage#performOk()
52      */
53     public boolean performOk() {
54         boolean result = super.performOk();
55         Plugin.getDefault().setTimer();
56         return result;
57     }
58
59 }