Merge xdebug from 1.3.x
[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
15 public class XDebugPreferencePage extends FieldEditorPreferencePage implements
16                 IWorkbenchPreferencePage {
17
18         /* Preference page for the default XDebug-Settings */
19         
20         private IntegerFieldEditor debugPort;
21
22         public XDebugPreferencePage() {
23                 super(FieldEditorPreferencePage.GRID);
24
25                 // Set the preference store for the preference page.
26                 IPreferenceStore store =
27                         XDebugCorePlugin.getDefault().getPreferenceStore();
28                 store.setDefault(IXDebugPreferenceConstants.DEBUGPORT_PREFERENCE,IXDebugPreferenceConstants.DEFAULT_DEBUGPORT);
29                 // get the default form the externalToolsPlugin 
30                 String interpreter=ExternalToolsPlugin.getDefault().getPreferenceStore().getString(ExternalToolsPlugin.PHP_RUN_PREF);
31                 store.setDefault(IXDebugPreferenceConstants.PHP_INTERPRETER_PREFERENCE,interpreter);
32                 setPreferenceStore(store);
33         }
34
35         public void init(IWorkbench workbench) {
36                 setDescription("Default Entries for XDebug:");
37         }
38
39         protected void createFieldEditors() {
40                 debugPort = new IntegerFieldEditor(IXDebugPreferenceConstants.DEBUGPORT_PREFERENCE, "&Debugport:", getFieldEditorParent(),5);
41                 debugPort.setValidRange(1025,65535);
42                 
43                 debugPort.setErrorMessage("Debugport must be between 1024 and 65536");
44                 addField(debugPort);
45                 
46                 FileFieldEditor phpInterpreter = new FileFieldEditor(IXDebugPreferenceConstants.PHP_INTERPRETER_PREFERENCE, "PHP &Interpreter:",true,getFieldEditorParent());
47             phpInterpreter.setErrorMessage("File not found");
48                 addField(phpInterpreter);
49                 
50         }
51         
52         public void performApply() {
53                 super.performApply();
54                 //XDebugCorePlugin.getDefault().setProxyPort(debugPort.getIntValue());
55         }
56
57
58
59
60 }