Modified: separate code for 'define'. was shown unnecessary closing parenthesis.
[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.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;
15
16 public class PHPHelpPreferencePage extends PreferencePage implements
17                 IWorkbenchPreferencePage {
18
19         FileFieldEditor phpCHMHelpFile;
20
21         BooleanFieldEditor phpCHMHelpEnabled;
22
23         StringFieldEditor phpCHMHelpCommand;
24
25         public PHPHelpPreferencePage() {
26                 super();
27                 setPreferenceStore(PHPHelpPlugin.getDefault().getPreferenceStore());
28                 setDescription(PHPHelpPreferenceMessages
29                                 .getString("PHPHelpPreferencePage.PHPHelpSettings")); //$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                 Composite composite = new Composite(parent, SWT.LEFT);
52                 composite.setLayout(new GridLayout());
53                 composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
54
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());
64
65                 phpCHMHelpEnabled = new BooleanFieldEditor(
66                                 PHPHelpPlugin.PHP_CHM_ENABLED, PHPHelpPreferenceMessages
67                                                 .getString("PHPHelpPreferencePage.PHPHelp.format"), //$NON-NLS-1$
68                                 composite);
69                 phpCHMHelpEnabled.setPage(this);
70                 phpCHMHelpEnabled.setPreferenceStore(getPreferenceStore());
71                 phpCHMHelpEnabled.load();
72
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$
77                                 composite);
78                 phpCHMHelpFile.setPage(this);
79                 phpCHMHelpFile.setPreferenceStore(getPreferenceStore());
80                 phpCHMHelpFile.load();
81
82                 new Label(composite, SWT.NONE);
83                 phpCHMHelpCommand = new StringFieldEditor(
84                                 PHPHelpPlugin.PHP_CHM_COMMAND, PHPHelpPreferenceMessages
85                                                 .getString("PHPHelpPreferencePage.PHPHelp.command"), //$NON-NLS-1$
86                                 composite);
87                 phpCHMHelpCommand.setPage(this);
88                 phpCHMHelpCommand.setPreferenceStore(getPreferenceStore());
89                 phpCHMHelpCommand.load();
90
91                 return composite;
92         }
93 }