X-Git-Url: http://secure.phpeclipse.com

diff --git a/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/DebuggerRunner.java b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/DebuggerRunner.java
index c7bb124..6003721 100644
--- a/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/DebuggerRunner.java
+++ b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/DebuggerRunner.java
@@ -8,53 +8,67 @@ http://www.eclipse.org/legal/cpl-v10.html
 Contributors:
 	IBM Corporation - Initial implementation
 	Vicente Fernando - www.alfersoft.com.ar
+	Christian Perkonig - remote Debug
 **********************************************************************/
 package net.sourceforge.phpdt.internal.launching;
 
 import java.util.Iterator;
 
+import net.sourceforge.phpdt.internal.core.JavaProject;
+import net.sourceforge.phpdt.internal.debug.core.Environment;
+import net.sourceforge.phpdt.internal.debug.core.PHPDBGProxy;
+import net.sourceforge.phpdt.internal.debug.core.model.PHPDebugTarget;
+
 import org.eclipse.core.resources.IProject;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.model.IProcess;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.Path;
-import net.sourceforge.phpdt.internal.debug.core.model.PHPDebugTarget;
-import net.sourceforge.phpdt.internal.debug.core.Environment;
-import net.sourceforge.phpdt.internal.debug.core.PHPDBGProxy;
-import net.sourceforge.phpeclipse.resourcesview.PHPProject;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.model.IProcess;
+//import net.sourceforge.phpeclipse.resourcesview.PHPProject;
 
 public class DebuggerRunner extends InterpreterRunner {
 
 	public IProcess run(InterpreterRunnerConfiguration configuration, ILaunch launch) {
 		String[] env;
 		String name, value;
-		PHPDBGProxy newPHPDBGProxy= new PHPDBGProxy();
+		PHPDBGProxy newPHPDBGProxy= new PHPDBGProxy(configuration.useRemoteDebugger(),
+		                                            configuration.getRemoteSourcePath());
 		int pos;
 
-		newPHPDBGProxy.start();
-		env= setEnvironmentVariables(newPHPDBGProxy.getPort(), configuration.getAbsoluteFileName(), configuration.getInterpreter().getCommand());
-
-		for(int i= 0; i < env.length; i++) {
-			pos= env[i].indexOf("=");
-			if(pos > -1) {
-				name= env[i].substring(0, pos);
-				value= env[i].substring(pos + 1);
-			} else {
-				name= env[i];
-				value= "";
-			}
-			Environment.setenv(name, value);
-		}
-		// now enviroment settings is made with Environment class
-		// because if new parameters are passed by array, doesn't inherit system vars
-		IProcess process = super.run(configuration, launch, null);
+
+		IProcess process =null;
 		PHPDebugTarget debugTarget = new PHPDebugTarget(launch, process);
-		newPHPDBGProxy.setDebugTarget(debugTarget);
+		newPHPDBGProxy.setDebugTarget(debugTarget);		
+		newPHPDBGProxy.start();				
+		if (configuration.useRemoteDebugger())
+		{
+			// listener for remote debuger is started 
+		}
+		else
+		{
+		
+			env= setEnvironmentVariables(newPHPDBGProxy.getPort(), configuration.getAbsoluteFileName(), configuration.getInterpreter().getCommand());
+			for(int i= 0; i < env.length; i++) {
+				pos= env[i].indexOf("=");
+				if(pos > -1) {
+					name= env[i].substring(0, pos);
+					value= env[i].substring(pos + 1);
+				} else {
+					name= env[i];
+					value= "";
+				}
+				Environment.setenv(name, value);
+			}
+			// now enviroment settings is made with Environment class
+			// because if new parameters are passed by array, doesn't inherit system vars
+			 process = super.run(configuration, launch, null);
+			debugTarget.setProcess(process);
+		}	
 		launch.addDebugTarget(debugTarget);
 
 		return process;
 	}
-
+	
 	protected String[] setEnvironmentVariables(int listenPort, String AbsoluteFileName, String interpreter) {
 		IPath FilePath= new Path(AbsoluteFileName);
 		String OSFilePath= FilePath.toOSString();
@@ -92,7 +106,7 @@ public class DebuggerRunner extends InterpreterRunner {
 	protected String renderLoadPath(InterpreterRunnerConfiguration configuration) {
 		StringBuffer loadPath = new StringBuffer();
 
-		PHPProject project = configuration.getProject();
+		JavaProject project = configuration.getProject();
 		addToLoadPath(loadPath, project.getProject());
 
 		Iterator referencedProjects = project.getReferencedProjects().iterator();