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.IPreferenceStore;
6 import org.eclipse.jface.preference.PreferencePage;
7 import org.eclipse.jface.preference.StringFieldEditor;
8 import org.eclipse.swt.SWT;
9 import org.eclipse.swt.layout.GridData;
10 import org.eclipse.swt.layout.GridLayout;
11 import org.eclipse.swt.widgets.Composite;
12 import org.eclipse.swt.widgets.Control;
13 import org.eclipse.swt.widgets.Label;
14 import org.eclipse.ui.IWorkbench;
15 import org.eclipse.ui.IWorkbenchPreferencePage;
17 public class PHPHelpPreferencePage
18 extends PreferencePage
19 implements IWorkbenchPreferencePage {
21 FileFieldEditor phpCHMHelpFile;
22 BooleanFieldEditor phpCHMHelpEnabled;
23 StringFieldEditor phpCHMHelpCommand;
25 public PHPHelpPreferencePage() {
27 setPreferenceStore(PHPHelpPlugin.getDefault().getPreferenceStore());
28 setDescription(PHPHelpPreferenceMessages.getString("PHPHelpPreferencePage.PHPHelpSettings")); //$NON-NLS-1$
31 public void init(IWorkbench workbench) {
34 protected void performDefaults() {
35 phpCHMHelpFile.loadDefault();
36 phpCHMHelpEnabled.loadDefault();
37 phpCHMHelpCommand.loadDefault();
38 super.performDefaults();
41 public boolean performOk() {
42 phpCHMHelpFile.store();
43 phpCHMHelpEnabled.store();
44 phpCHMHelpCommand.store();
45 return super.performOk();
48 protected Control createContents(Composite parent) {
49 initializeDialogUnits(parent);
50 final IPreferenceStore store =
51 PHPHelpPlugin.getDefault().getPreferenceStore();
52 Composite composite = new Composite(parent, SWT.LEFT);
53 composite.setLayout(new GridLayout());
54 composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
56 // Composite helpSettingsComposite = new Composite(composite, SWT.NONE);
57 // helpSettingsComposite.setLayout(new GridLayout());
58 // helpSettingsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
59 // Group helpSettingsGroup = new Group(helpSettingsComposite, SWT.NONE);
60 // helpSettingsGroup.setText("Windows CHM settings");
61 // helpSettingsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
62 // helpSettingsGroup.setLayout(new GridLayout());
65 new BooleanFieldEditor(
66 PHPHelpPlugin.PHP_CHM_ENABLED,
67 PHPHelpPreferenceMessages.getString("PHPHelpPreferencePage.PHPHelp.format"), //$NON-NLS-1$
69 phpCHMHelpEnabled.setPreferencePage(this);
70 phpCHMHelpEnabled.setPreferenceStore(getPreferenceStore());
71 phpCHMHelpEnabled.load();
73 new Label(composite, SWT.NONE);
76 PHPHelpPlugin.PHP_CHM_FILE,
77 PHPHelpPreferenceMessages.getString("PHPHelpPreferencePage.PHPHelp.chm.file"), //$NON-NLS-1$
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,
87 PHPHelpPreferenceMessages.getString("PHPHelpPreferencePage.PHPHelp.command"), //$NON-NLS-1$
89 phpCHMHelpCommand.setPreferencePage(this);
90 phpCHMHelpCommand.setPreferenceStore(getPreferenceStore());
91 phpCHMHelpCommand.load();