ed_mann's fix for ticket #322
[phpeclipse.git] / net.sourceforge.phpeclipse.externaltools / src / net / sourceforge / phpdt / externaltools / preferences / PHPExternalToolsPreferencePage.java
1 package net.sourceforge.phpdt.externaltools.preferences;
2
3 import net.sourceforge.phpeclipse.externaltools.ExternalToolsPlugin;
4
5 import org.eclipse.jface.preference.FileFieldEditor;
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 PHPExternalToolsPreferencePage extends PreferencePage implements
18                 IWorkbenchPreferencePage {
19
20         StringFieldEditor externalParserSFE;
21
22         FileFieldEditor phpRunFFE;
23
24         public PHPExternalToolsPreferencePage() {
25                 super();
26                 setPreferenceStore(ExternalToolsPlugin.getDefault()
27                                 .getPreferenceStore());
28         }
29
30         public void init(IWorkbench workbench) {
31         }
32
33         protected void performDefaults() {
34                 externalParserSFE.loadDefault();
35                 phpRunFFE.loadDefault();
36                 super.performDefaults();
37         }
38
39         public boolean performOk() {
40                 externalParserSFE.store();
41                 phpRunFFE.store();
42                 return super.performOk();
43         }
44
45         protected Control createContents(Composite parent) {
46                 initializeDialogUnits(parent);
47                 Composite composite = new Composite(parent, SWT.LEFT);
48                 composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
49
50                 phpRunFFE = new FileFieldEditor(ExternalToolsPlugin.PHP_RUN_PREF,
51                                 PHPPreferencesMessages
52                                                 .getString("PHPBasePreferencePage.console.php"),
53                                 composite);
54                 phpRunFFE.setPage(this);
55                 phpRunFFE.setPreferenceStore(getPreferenceStore());
56                 phpRunFFE.load();
57
58                 externalParserSFE = new StringFieldEditor(
59                                 ExternalToolsPlugin.EXTERNAL_PARSER_PREF,
60                                 PHPPreferencesMessages
61                                                 .getString("PHPBasePreferencePage.parsers.extcommand"),
62                                 composite);
63                 externalParserSFE.setPage(this);
64                 externalParserSFE.setPreferenceStore(getPreferenceStore());
65                 externalParserSFE.load();
66                 new Label(composite, SWT.NONE);
67
68                 composite.setLayout(new GridLayout(3, false));
69                 return composite;
70         }
71 }