X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/launching/PHPLaunchConfigurationDelegate.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/launching/PHPLaunchConfigurationDelegate.java index be1286b..a47326f 100644 --- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/launching/PHPLaunchConfigurationDelegate.java +++ b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/launching/PHPLaunchConfigurationDelegate.java @@ -14,10 +14,15 @@ package net.sourceforge.phpeclipse.xdebug.php.launching; import java.io.File; import java.text.MessageFormat; import java.util.ArrayList; +import java.util.Iterator; import java.util.List; +import java.util.Map; +import net.sourceforge.phpeclipse.externaltools.ExternalToolsPlugin; +import net.sourceforge.phpeclipse.xdebug.core.IProxyEventListener; import net.sourceforge.phpeclipse.xdebug.core.IXDebugPreferenceConstants; import net.sourceforge.phpeclipse.xdebug.core.XDebugCorePlugin; +import net.sourceforge.phpeclipse.xdebug.core.XDebugProxy; import net.sourceforge.phpeclipse.xdebug.php.model.XDebugTarget; import org.eclipse.core.resources.IFile; @@ -31,7 +36,7 @@ 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.model.IDebugTarget; +//import org.eclipse.debug.core.model.IDebugTarget; import org.eclipse.debug.core.model.ILaunchConfigurationDelegate; import org.eclipse.debug.core.model.IProcess; import org.eclipse.debug.core.model.LaunchConfigurationDelegate; @@ -48,9 +53,12 @@ public class PHPLaunchConfigurationDelegate extends LaunchConfigurationDelegate String phpInterpreter = configuration.getAttribute(IXDebugConstants.ATTR_PHP_INTERPRETER, (String)null); boolean useDefaultInterpreter= configuration.getAttribute(IXDebugConstants.ATTR_PHP_DEFAULT_INTERPRETER, true); - if (useDefaultInterpreter) + if (useDefaultInterpreter) { phpInterpreter=XDebugCorePlugin.getDefault().getPreferenceStore().getString(IXDebugPreferenceConstants.PHP_INTERPRETER_PREFERENCE); - + if (phpInterpreter=="") { + phpInterpreter=ExternalToolsPlugin.getDefault().getPreferenceStore().getString(ExternalToolsPlugin.PHP_RUN_PREF); + } + } File exe = new File(phpInterpreter); // Just to get sure that the interpreter exists if (!exe.exists()) { @@ -74,36 +82,55 @@ public class PHPLaunchConfigurationDelegate extends LaunchConfigurationDelegate } commandList.add(file.getLocation().toOSString()); - String[] envp=DebugPlugin.getDefault().getLaunchManager().getEnvironment(configuration); - // Get de Debugport form the Launchconfiguration or from the preferences - int debugPort = configuration.getAttribute(IXDebugConstants.ATTR_PHP_DEBUGPORT,-1); - boolean useDefaultPort= configuration.getAttribute(IXDebugConstants.ATTR_PHP_DEFAULT_DEBUGPORT, true); - if (useDefaultPort) - debugPort=XDebugCorePlugin.getDefault().getPreferenceStore().getInt(IXDebugPreferenceConstants.DEBUGPORT_PREFERENCE); - if (debugPort<1024) - debugPort=IXDebugPreferenceConstants.DEFAULT_DEBUGPORT; + // Get the Debugport from the preferences + int debugPort=XDebugCorePlugin.getDefault().getPreferenceStore().getInt(IXDebugPreferenceConstants.DEBUGPORT_PREFERENCE); + // check for default port + if (debugPort==0) + debugPort=IXDebugPreferenceConstants.DEFAULT_DEBUGPORT; + + String[] envp=DebugPlugin.getDefault().getLaunchManager().getEnvironment(configuration); + // appends the environment to the native environment + if (envp==null) { + Map stringVars = DebugPlugin.getDefault().getLaunchManager().getNativeEnvironment(); + int idx=0; + envp= new String[stringVars.size()]; + for (Iterator i = stringVars.keySet().iterator(); i.hasNext();) { + String key = (String) i.next(); + String value = (String) stringVars.get(key); + envp[idx++]=key+"="+value; + } + } + String idekey=fileName+"-"+(int)(Math.random()*100000); if (mode.equals(ILaunchManager.DEBUG_MODE)) { - String[] env; - if (envp!=null) { - env = new String[envp.length+1]; - for(int i=0;i