Added ParserPreferencePage
[phpeclipse.git] / net.sourceforge.phpeclipse.phphelp / src / net / sourceforge / phpdt / phphelp / PHPHelpPreferencePage.java
1 package net.sourceforge.phpdt.phphelp;
2
3 import org.eclipse.jface.preference.BooleanFieldEditor;
4 import org.eclipse.jface.preference.DirectoryFieldEditor;
5 import org.eclipse.jface.preference.FileFieldEditor;
6 import org.eclipse.jface.preference.IPreferenceStore;
7 import org.eclipse.jface.preference.PreferencePage;
8 import org.eclipse.jface.preference.StringFieldEditor;
9 import org.eclipse.swt.SWT;
10 import org.eclipse.swt.layout.GridData;
11 import org.eclipse.swt.layout.GridLayout;
12 import org.eclipse.swt.widgets.Composite;
13 import org.eclipse.swt.widgets.Control;
14 import org.eclipse.swt.widgets.Group;
15 import org.eclipse.swt.widgets.Label;
16 import org.eclipse.ui.IWorkbench;
17 import org.eclipse.ui.IWorkbenchPreferencePage;
18
19 public class PHPHelpPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
20
21
22   FileFieldEditor phpCHMHelpFile;
23   BooleanFieldEditor phpCHMHelpEnabled;
24   StringFieldEditor phpCHMHelpCommand;
25
26   public PHPHelpPreferencePage() {
27     super();
28     setPreferenceStore(PHPHelpPlugin.getDefault().getPreferenceStore());
29     setDescription("PHP Help Settings (WIN_32 only)"); //$NON-NLS-1$
30   }
31   
32   public void init(IWorkbench workbench) {
33   }
34   
35   protected void performDefaults() {
36     phpCHMHelpFile.loadDefault();
37     phpCHMHelpEnabled.loadDefault();
38     phpCHMHelpCommand.loadDefault();
39     super.performDefaults();
40   }
41
42   public boolean performOk() {
43     phpCHMHelpFile.store();
44     phpCHMHelpEnabled.store();
45     phpCHMHelpCommand.store();
46     return super.performOk();
47   }
48
49   protected Control createContents(Composite parent) {
50     initializeDialogUnits(parent);
51     final IPreferenceStore store = PHPHelpPlugin.getDefault().getPreferenceStore();
52     Composite composite = new Composite(parent, SWT.LEFT);
53     composite.setLayout(new GridLayout());
54     composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
55     
56  
57 //    Composite helpSettingsComposite = new Composite(composite, SWT.NONE);
58 //    helpSettingsComposite.setLayout(new GridLayout());
59 //    helpSettingsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
60 //    Group helpSettingsGroup = new Group(helpSettingsComposite, SWT.NONE);
61 //    helpSettingsGroup.setText("Windows CHM settings");
62 //    helpSettingsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
63 //    helpSettingsGroup.setLayout(new GridLayout());
64
65     phpCHMHelpEnabled =
66       new BooleanFieldEditor(
67         PHPHelpPlugin.PHP_CHM_ENABLED,
68         "Show Help in *.chm format?",
69     composite);
70     phpCHMHelpEnabled.setPreferencePage(this);
71     phpCHMHelpEnabled.setPreferenceStore(getPreferenceStore());
72     phpCHMHelpEnabled.load();
73     
74     new Label(composite, SWT.NONE);
75     phpCHMHelpFile =
76       new FileFieldEditor(
77     PHPHelpPlugin.PHP_CHM_FILE,"PHP *.chm file:",
78     composite);
79     phpCHMHelpFile.setPreferencePage(this);
80     phpCHMHelpFile.setPreferenceStore(getPreferenceStore());
81     phpCHMHelpFile.load();
82     
83     new Label(composite, SWT.NONE);
84     phpCHMHelpCommand =
85       new StringFieldEditor(
86         PHPHelpPlugin.PHP_CHM_COMMAND,
87         "PHP Help command:",
88     composite);
89     phpCHMHelpCommand.setPreferencePage(this);
90     phpCHMHelpCommand.setPreferenceStore(getPreferenceStore());
91     phpCHMHelpCommand.load();
92
93     
94     return composite;
95   }
96 }