Debugger now steps through embedded PHP in HTML files.
authorstefanbjarni <stefanbjarni>
Wed, 25 May 2005 21:45:54 +0000 (21:45 +0000)
committerstefanbjarni <stefanbjarni>
Wed, 25 May 2005 21:45:54 +0000 (21:45 +0000)
Fixed a bug that prevented the debugger from popping up the right line in a PHP editor.

Mods:

debug.ui plugin:
    PHPSourceLocator.java: Moved this file to the launching plugin

launching:
    PHPSourceLocator.java:
        Moved this file from the debug.ui plugin
    PHPLaunchConfigurationDelegate.java:
        Added the getLaunch method.
        This puts the PHP source locator into the launch,
        which let's the debugger client find lines in PHP source.
    plugin.xml:
        PHP debugger now associated with .htm and .html files,
        so it's possible to step through embedded PHP code in HTML files.

Tested: PHPeclipse CVS HEAD on Windows, against Xampp on local host.

net.sourceforge.phpeclipse.launching/plugin.xml
net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/PHPLaunchConfigurationDelegate.java
net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/PHPSourceLocator.java [moved from net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPSourceLocator.java with 97% similarity]

index ca346bd..4836ae5 100644 (file)
@@ -23,6 +23,7 @@
       <import plugin="net.sourceforge.phpeclipse.debug.core"/>
       <import plugin="org.eclipse.debug.ui"/>
       <import plugin="net.sourceforge.phpeclipse.ui"/>
+      <import plugin="org.eclipse.ui.ide"/>
    </requires>
 
 
                default="true"
                extension="php5">
          </fileExtension>
+         <fileExtension 
+               default="true"
+               extension="htm">
+         </fileExtension>
+         <fileExtension 
+               default="true"
+               extension="html">
+         </fileExtension>
       </launchConfigurationType>
    </extension>
 
index 434dd50..6324404 100644 (file)
@@ -1,19 +1,16 @@
 /**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
-       IBM Corporation - Initial implementation
-       Vicente Fernando - www.alfersoft.com.ar
-**********************************************************************/
+ Copyright (c) 2000, 2002 IBM Corp. and others.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Common Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/cpl-v10.html
+ Contributors:
+ IBM Corporation - Initial implementation
+ Vicente Fernando - www.alfersoft.com.ar
+ **********************************************************************/
 package net.sourceforge.phpdt.internal.launching;
 
-//import java.io.OutputStream;
-
-
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
@@ -21,28 +18,45 @@ import org.eclipse.core.runtime.Status;
 import org.eclipse.debug.core.DebugPlugin;
 import org.eclipse.debug.core.ILaunch;
 import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.Launch;
 import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
 import org.eclipse.debug.core.model.LaunchConfigurationDelegate;
-//import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
-
 
 public class PHPLaunchConfigurationDelegate extends LaunchConfigurationDelegate {
-       protected static final InterpreterRunner interpreterRunner = new InterpreterRunner();
-       protected static final DebuggerRunner debuggerRunner = new DebuggerRunner();
+       
+       protected static final InterpreterRunner interpreterRunner;
+       protected static final DebuggerRunner debuggerRunner;
+       
+       static {
+               interpreterRunner  = new InterpreterRunner();
+               debuggerRunner = new DebuggerRunner();
+       }
 
-/*     public PHPLaunchConfigurationDelegate() {
-               super();
+       /** (non-Javadoc)
+        * @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate2#getLaunch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String)
+        */
+       public ILaunch getLaunch(ILaunchConfiguration configuration, String mode) 
+       throws CoreException {
+               return new Launch(configuration, mode, new PHPSourceLocator());
        }
-*/
+       
        /**
         * @see ILaunchConfigurationDelegate#launch(ILaunchConfiguration, String, ILaunch, IProgressMonitor)
         */
-       public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
-               if (PHPRuntime.getDefault().getSelectedInterpreter() == null)
-                       throw new CoreException(new Status(IStatus.ERROR, PHPLaunchingPlugin.PLUGIN_ID, IStatus.OK, "You must define an interpreter before running PHP.", null));
+       public void 
+       launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
+               if (PHPRuntime.getDefault().getSelectedInterpreter() == null) {
+                       String pid = PHPLaunchingPlugin.PLUGIN_ID;
+                       String msg = "You must define an interpreter before running PHP.";
+                       IStatus s = new Status(IStatus.ERROR, pid, IStatus.OK, msg, null);
+                       throw new CoreException(s);
+               }
                
-               InterpreterRunnerConfiguration conf=new InterpreterRunnerConfiguration(configuration);
-               conf.setEnvironment(DebugPlugin.getDefault().getLaunchManager().getEnvironment(configuration));
+               InterpreterRunnerConfiguration conf = new 
+                       InterpreterRunnerConfiguration(configuration);
+               ILaunchManager m = DebugPlugin.getDefault().getLaunchManager();
+               conf.setEnvironment(m.getEnvironment(configuration));
                if (mode.equals("debug")) {
                        debuggerRunner.run(conf, launch);
                } else {
@@ -1,10 +1,9 @@
-package net.sourceforge.phpdt.internal.debug.ui;
+package net.sourceforge.phpdt.internal.launching;
 
 import java.util.Iterator;
 import java.util.Map;
 
 import net.sourceforge.phpdt.internal.debug.core.model.PHPStackFrame;
-import net.sourceforge.phpdt.internal.launching.PHPLaunchConfigurationAttribute;
 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
 import net.sourceforge.phpeclipse.builder.ExternalEditorInput;
 import net.sourceforge.phpeclipse.builder.FileStorage;