1) Fixed issue #779: PHPEclipse reports error with a correct try/catch block
[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                 
27         if (ExternalToolsPlugin.getDefault () != null) {
28             setPreferenceStore (ExternalToolsPlugin.getDefault().getPreferenceStore());
29         }
30         }
31
32         public void init(IWorkbench workbench) {
33         }
34
35         protected void performDefaults() {
36                 externalParserSFE.loadDefault();
37                 phpRunFFE.loadDefault();
38                 super.performDefaults();
39         }
40
41         public boolean performOk() {
42                 externalParserSFE.store();
43                 phpRunFFE.store();
44                 return super.performOk();
45         }
46
47         protected Control createContents(Composite parent) {
48                 initializeDialogUnits(parent);
49                 Composite composite = new Composite(parent, SWT.LEFT);
50                 composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
51
52                 phpRunFFE = new FileFieldEditor(ExternalToolsPlugin.PHP_RUN_PREF,
53                                 PHPPreferencesMessages
54                                                 .getString("PHPBasePreferencePage.console.php"),
55                                 composite);
56                 phpRunFFE.setPage(this);
57                 phpRunFFE.setPreferenceStore(getPreferenceStore());
58                 phpRunFFE.load();
59
60                 externalParserSFE = new StringFieldEditor(
61                                 ExternalToolsPlugin.EXTERNAL_PARSER_PREF,
62                                 PHPPreferencesMessages
63                                                 .getString("PHPBasePreferencePage.parsers.extcommand"),
64                                 composite);
65                 externalParserSFE.setPage(this);
66                 externalParserSFE.setPreferenceStore(getPreferenceStore());
67                 externalParserSFE.load();
68                 new Label(composite, SWT.NONE);
69
70                 composite.setLayout(new GridLayout(3, false));
71                 return composite;
72         }
73 }