50435bf46d42155f11a33afae1a08ad3d14ef232
[phpeclipse.git] / net.sourceforge.phpeclipse.xdebug.ui / src / net / sourceforge / phpeclipse / xdebug / ui / preference / XDebugPreferencePage.java
1 package net.sourceforge.phpeclipse.xdebug.ui.preference;
2
3 import net.sourceforge.phpeclipse.externaltools.ExternalToolsPlugin;
4 import net.sourceforge.phpeclipse.xdebug.core.IXDebugPreferenceConstants;
5 import net.sourceforge.phpeclipse.xdebug.core.XDebugCorePlugin;
6
7 import org.eclipse.jface.preference.FieldEditorPreferencePage;
8 import org.eclipse.jface.preference.FileFieldEditor;
9 import org.eclipse.jface.preference.IPreferenceStore;
10 import org.eclipse.jface.preference.IntegerFieldEditor;
11 import org.eclipse.ui.IWorkbench;
12 import org.eclipse.ui.IWorkbenchPreferencePage;
13
14 public class XDebugPreferencePage extends FieldEditorPreferencePage implements
15                 IWorkbenchPreferencePage {
16
17         /* Preference page for the default XDebug-Settings */
18
19         public XDebugPreferencePage() {
20                 super(FieldEditorPreferencePage.GRID);
21
22                 // Set the preference store for the preference page.
23                 IPreferenceStore store = XDebugCorePlugin.getDefault()
24                                 .getPreferenceStore();
25                 store.setDefault(IXDebugPreferenceConstants.DEBUGPORT_PREFERENCE,
26                                 IXDebugPreferenceConstants.DEFAULT_DEBUGPORT);
27                 // get the default form the externalToolsPlugin
28                 String interpreter = ExternalToolsPlugin.getDefault()
29                                 .getPreferenceStore().getString(
30                                                 ExternalToolsPlugin.PHP_RUN_PREF);
31                 store.setDefault(IXDebugPreferenceConstants.PHP_INTERPRETER_PREFERENCE,
32                                 interpreter);
33                 setPreferenceStore(store);
34         }
35
36         public void init(IWorkbench workbench) {
37                 setDescription("Default Entries for XDebug:");
38         }
39
40         protected void createFieldEditors() {
41                 IntegerFieldEditor debugPort = new IntegerFieldEditor(
42                                 IXDebugPreferenceConstants.DEBUGPORT_PREFERENCE, "&Debugport:",
43                                 getFieldEditorParent(), 5);
44                 debugPort.setValidRange(1025, 65535);
45                 debugPort.setErrorMessage("Debugport must be between 1024 and 65536");
46                 addField(debugPort);
47
48                 FileFieldEditor phpInterpreter = new FileFieldEditor(
49                                 IXDebugPreferenceConstants.PHP_INTERPRETER_PREFERENCE,
50                                 "PHP &Interpreter:", true, getFieldEditorParent());
51                 phpInterpreter.setErrorMessage("File not found");
52                 addField(phpInterpreter);
53
54         }
55
56 }