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;
 
  14 public class XDebugPreferencePage extends FieldEditorPreferencePage implements
 
  15                 IWorkbenchPreferencePage {
 
  17         /* Preference page for the default XDebug-Settings */
 
  19         public XDebugPreferencePage() {
 
  20                 super(FieldEditorPreferencePage.GRID);
 
  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,
 
  33                 setPreferenceStore(store);
 
  36         public void init(IWorkbench workbench) {
 
  37                 setDescription("Default Entries for XDebug:");
 
  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");
 
  48                 FileFieldEditor phpInterpreter = new FileFieldEditor(
 
  49                                 IXDebugPreferenceConstants.PHP_INTERPRETER_PREFERENCE,
 
  50                                 "PHP &Interpreter:", true, getFieldEditorParent());
 
  51                 phpInterpreter.setErrorMessage("File not found");
 
  52                 addField(phpInterpreter);