1 package net.sourceforge.phpdt.phphelp;
3 import org.eclipse.jface.preference.BooleanFieldEditor;
4 import org.eclipse.jface.preference.FileFieldEditor;
5 import org.eclipse.jface.preference.PreferencePage;
6 import org.eclipse.jface.preference.StringFieldEditor;
7 import org.eclipse.swt.SWT;
8 import org.eclipse.swt.layout.GridData;
9 import org.eclipse.swt.layout.GridLayout;
10 import org.eclipse.swt.widgets.Composite;
11 import org.eclipse.swt.widgets.Control;
12 import org.eclipse.swt.widgets.Label;
13 import org.eclipse.ui.IWorkbench;
14 import org.eclipse.ui.IWorkbenchPreferencePage;
16 public class PHPHelpPreferencePage extends PreferencePage implements
17 IWorkbenchPreferencePage {
19 FileFieldEditor phpCHMHelpFile;
21 BooleanFieldEditor phpCHMHelpEnabled;
23 StringFieldEditor phpCHMHelpCommand;
25 public PHPHelpPreferencePage() {
27 setPreferenceStore(PHPHelpPlugin.getDefault().getPreferenceStore());
28 setDescription(PHPHelpPreferenceMessages
29 .getString("PHPHelpPreferencePage.PHPHelpSettings")); //$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 Composite composite = new Composite(parent, SWT.LEFT);
52 composite.setLayout(new GridLayout());
53 composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
55 // Composite helpSettingsComposite = new Composite(composite, SWT.NONE);
56 // helpSettingsComposite.setLayout(new GridLayout());
57 // helpSettingsComposite.setLayoutData(new
58 // GridData(GridData.FILL_HORIZONTAL));
59 // Group helpSettingsGroup = new Group(helpSettingsComposite, SWT.NONE);
60 // helpSettingsGroup.setText("Windows CHM settings");
61 // helpSettingsGroup.setLayoutData(new
62 // GridData(GridData.FILL_HORIZONTAL));
63 // helpSettingsGroup.setLayout(new GridLayout());
65 phpCHMHelpEnabled = new BooleanFieldEditor(
66 PHPHelpPlugin.PHP_CHM_ENABLED, PHPHelpPreferenceMessages
67 .getString("PHPHelpPreferencePage.PHPHelp.format"), //$NON-NLS-1$
69 phpCHMHelpEnabled.setPage(this);
70 phpCHMHelpEnabled.setPreferenceStore(getPreferenceStore());
71 phpCHMHelpEnabled.load();
73 new Label(composite, SWT.NONE);
74 phpCHMHelpFile = new FileFieldEditor(PHPHelpPlugin.PHP_CHM_FILE,
75 PHPHelpPreferenceMessages
76 .getString("PHPHelpPreferencePage.PHPHelp.chm.file"), //$NON-NLS-1$
78 phpCHMHelpFile.setPage(this);
79 phpCHMHelpFile.setPreferenceStore(getPreferenceStore());
80 phpCHMHelpFile.load();
82 new Label(composite, SWT.NONE);
83 phpCHMHelpCommand = new StringFieldEditor(
84 PHPHelpPlugin.PHP_CHM_COMMAND, PHPHelpPreferenceMessages
85 .getString("PHPHelpPreferencePage.PHPHelp.command"), //$NON-NLS-1$
87 phpCHMHelpCommand.setPage(this);
88 phpCHMHelpCommand.setPreferenceStore(getPreferenceStore());
89 phpCHMHelpCommand.load();