From: stefanbjarni Date: Wed, 25 May 2005 21:45:54 +0000 (+0000) Subject: Debugger now steps through embedded PHP in HTML files. X-Git-Url: http://git.phpeclipse.com Debugger now steps through embedded PHP in HTML files. 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. --- diff --git a/net.sourceforge.phpeclipse.launching/plugin.xml b/net.sourceforge.phpeclipse.launching/plugin.xml index ca346bd..4836ae5 100644 --- a/net.sourceforge.phpeclipse.launching/plugin.xml +++ b/net.sourceforge.phpeclipse.launching/plugin.xml @@ -23,6 +23,7 @@ + @@ -49,6 +50,14 @@ default="true" extension="php5"> + + + + diff --git a/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/PHPLaunchConfigurationDelegate.java b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/PHPLaunchConfigurationDelegate.java index 434dd50..6324404 100644 --- a/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/PHPLaunchConfigurationDelegate.java +++ b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/PHPLaunchConfigurationDelegate.java @@ -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 { diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPSourceLocator.java b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/PHPSourceLocator.java similarity index 97% rename from net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPSourceLocator.java rename to net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/PHPSourceLocator.java index 8dfbfdd..7fb4da2 100644 --- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPSourceLocator.java +++ b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/PHPSourceLocator.java @@ -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;