*** empty log message ***
[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.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;
16
17 public class PHPHelpPreferencePage
18   extends PreferencePage
19   implements IWorkbenchPreferencePage {
20
21   FileFieldEditor phpCHMHelpFile;
22   BooleanFieldEditor phpCHMHelpEnabled;
23   StringFieldEditor phpCHMHelpCommand;
24
25   public PHPHelpPreferencePage() {
26     super();
27     setPreferenceStore(PHPHelpPlugin.getDefault().getPreferenceStore());
28     setDescription(PHPHelpPreferenceMessages.getString("PHPHelpPreferencePage.PHPHelpSettings"));   //$NON-NLS-1$
29   }
30
31   public void init(IWorkbench workbench) {
32   }
33
34   protected void performDefaults() {
35     phpCHMHelpFile.loadDefault();
36     phpCHMHelpEnabled.loadDefault();
37     phpCHMHelpCommand.loadDefault();
38     super.performDefaults();
39   }
40
41   public boolean performOk() {
42     phpCHMHelpFile.store();
43     phpCHMHelpEnabled.store();
44     phpCHMHelpCommand.store();
45     return super.performOk();
46   }
47
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));
55
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());
63
64     phpCHMHelpEnabled =
65       new BooleanFieldEditor(
66         PHPHelpPlugin.PHP_CHM_ENABLED,
67         PHPHelpPreferenceMessages.getString("PHPHelpPreferencePage.PHPHelp.format"), //$NON-NLS-1$
68         composite);
69     phpCHMHelpEnabled.setPreferencePage(this);
70     phpCHMHelpEnabled.setPreferenceStore(getPreferenceStore());
71     phpCHMHelpEnabled.load();
72
73     new Label(composite, SWT.NONE);
74     phpCHMHelpFile =
75       new FileFieldEditor(
76         PHPHelpPlugin.PHP_CHM_FILE,
77         PHPHelpPreferenceMessages.getString("PHPHelpPreferencePage.PHPHelp.chm.file"), //$NON-NLS-1$
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         PHPHelpPreferenceMessages.getString("PHPHelpPreferencePage.PHPHelp.command"), //$NON-NLS-1$
88         composite);
89     phpCHMHelpCommand.setPreferencePage(this);
90     phpCHMHelpCommand.setPreferenceStore(getPreferenceStore());
91     phpCHMHelpCommand.load();
92
93     return composite;
94   }
95 }