1 package net.sourceforge.phpeclipse.xdebug.ui.preference;
3 import net.sourceforge.phpeclipse.externaltools.ExternalToolsPlugin;
4 import net.sourceforge.phpeclipse.xdebug.core.IXDebugPreferenceConstants;
5 import net.sourceforge.phpeclipse.xdebug.core.XDebugCorePlugin;
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;
15 public class XDebugPreferencePage extends FieldEditorPreferencePage implements
16 IWorkbenchPreferencePage {
18 /* Preference page for the default XDebug-Settings */
20 private IntegerFieldEditor debugPort;
22 public XDebugPreferencePage() {
23 super(FieldEditorPreferencePage.GRID);
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);
35 public void init(IWorkbench workbench) {
36 setDescription("Default Entries for XDebug:");
39 protected void createFieldEditors() {
40 debugPort = new IntegerFieldEditor(IXDebugPreferenceConstants.DEBUGPORT_PREFERENCE, "&Debugport:", getFieldEditorParent(),5);
41 debugPort.setValidRange(1025,65535);
43 debugPort.setErrorMessage("Debugport must be between 1024 and 65536");
46 FileFieldEditor phpInterpreter = new FileFieldEditor(IXDebugPreferenceConstants.PHP_INTERPRETER_PREFERENCE, "PHP &Interpreter:",true,getFieldEditorParent());
47 phpInterpreter.setErrorMessage("File not found");
48 addField(phpInterpreter);
52 public void performApply() {
54 XDebugCorePlugin.getDefault().setProxyPort(debugPort.getIntValue());