1 package net.sourceforge.phpdt.phphelp;
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;
19 public class PHPHelpPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
22 FileFieldEditor phpCHMHelpFile;
23 BooleanFieldEditor phpCHMHelpEnabled;
24 StringFieldEditor phpCHMHelpCommand;
26 public PHPHelpPreferencePage() {
28 setPreferenceStore(PHPHelpPlugin.getDefault().getPreferenceStore());
29 setDescription("PHP Help Settings (WIN_32 only)"); //$NON-NLS-1$
32 public void init(IWorkbench workbench) {
35 protected void performDefaults() {
36 phpCHMHelpFile.loadDefault();
37 phpCHMHelpEnabled.loadDefault();
38 phpCHMHelpCommand.loadDefault();
39 super.performDefaults();
42 public boolean performOk() {
43 phpCHMHelpFile.store();
44 phpCHMHelpEnabled.store();
45 phpCHMHelpCommand.store();
46 return super.performOk();
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));
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());
66 new BooleanFieldEditor(
67 PHPHelpPlugin.PHP_CHM_ENABLED,
68 "Show Help in *.chm format?",
70 phpCHMHelpEnabled.setPreferencePage(this);
71 phpCHMHelpEnabled.setPreferenceStore(getPreferenceStore());
72 phpCHMHelpEnabled.load();
74 new Label(composite, SWT.NONE);
77 PHPHelpPlugin.PHP_CHM_FILE,"PHP *.chm file:",
79 phpCHMHelpFile.setPreferencePage(this);
80 phpCHMHelpFile.setPreferenceStore(getPreferenceStore());
81 phpCHMHelpFile.load();
83 new Label(composite, SWT.NONE);
85 new StringFieldEditor(
86 PHPHelpPlugin.PHP_CHM_COMMAND,
89 phpCHMHelpCommand.setPreferencePage(this);
90 phpCHMHelpCommand.setPreferenceStore(getPreferenceStore());
91 phpCHMHelpCommand.load();