Goto line/Goto Matching Bracket Shortcuts should work
[phpeclipse.git] / net.sourceforge.phpeclipse.launching / src / net / sourceforge / phpdt / internal / launching / InterpreterRunner.java
index 5e76ed5..cae1655 100644 (file)
@@ -4,9 +4,10 @@ import java.io.File;
 import java.io.IOException;
 import java.util.Iterator;
 
-import net.sourceforge.phpeclipse.resourcesview.PHPProject;
-import org.eclipse.core.boot.BootLoader;
+import net.sourceforge.phpdt.internal.core.JavaProject;
+
 import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.Platform;
 import org.eclipse.debug.core.DebugPlugin;
 import org.eclipse.debug.core.ILaunch;
 import org.eclipse.debug.core.model.IProcess;
@@ -16,19 +17,20 @@ public class InterpreterRunner {
        public InterpreterRunner() {
        }
 
-       public IProcess run(InterpreterRunnerConfiguration configuration, ILaunch launch) {
-               String commandLine = renderCommandLine(configuration);
+       public IProcess run(InterpreterRunnerConfiguration configuration, ILaunch launch, String[] env) {               
+               String commandLine = renderCommandLine(configuration);          
                File workingDirectory = configuration.getAbsoluteWorkingDirectory();
 
                Process nativePHPProcess = null;
                try {
-                       nativePHPProcess = configuration.getInterpreter().exec(commandLine, workingDirectory);
+                       nativePHPProcess = configuration.getInterpreter().exec(commandLine, workingDirectory, env);
                } catch (IOException e) {
                        throw new RuntimeException("Unable to execute interpreter: " + commandLine + workingDirectory);
                }
 
-               IProcess process = DebugPlugin.getDefault().newProcess(launch, nativePHPProcess, renderLabel(configuration));
+               IProcess process = DebugPlugin.newProcess(launch, nativePHPProcess, renderLabel(configuration));
                process.setAttribute(PHPLaunchingPlugin.PLUGIN_ID + ".launcher.cmdline", commandLine);
+
                return process ;
        }
 
@@ -58,26 +60,25 @@ public class InterpreterRunner {
                return buffer.toString();
        }
 
-//     protected String renderLoadPath(InterpreterRunnerConfiguration configuration) {
-//             StringBuffer loadPath = new StringBuffer();
-//
-//             PHPProject project = configuration.getProject();
-//             addToLoadPath(loadPath, project.getProject());
-//
-//             Iterator referencedProjects = project.getReferencedProjects().iterator();
-//             while (referencedProjects.hasNext())
-//                     addToLoadPath(loadPath, (IProject) referencedProjects.next());
-//
-//             return loadPath.toString();
-//     }
-
-//     protected void addToLoadPath(StringBuffer loadPath, IProject project) {
-//
-//             loadPath.append(" -I " + osDependentPath(project.getLocation().toOSString()));
-//     }
+       protected String renderLoadPath(InterpreterRunnerConfiguration configuration) {
+               StringBuffer loadPath = new StringBuffer();
+
+               JavaProject project = configuration.getProject();
+               addToLoadPath(loadPath, project.getProject());
+
+               Iterator referencedProjects = project.getReferencedProjects().iterator();
+               while (referencedProjects.hasNext())
+                       addToLoadPath(loadPath, (IProject) referencedProjects.next());
+
+               return loadPath.toString();
+       }
+
+       protected void addToLoadPath(StringBuffer loadPath, IProject project) {
+               loadPath.append(" -I " + osDependentPath(project.getLocation().toOSString()));
+       }
 
        protected String osDependentPath(String aPath) {
-               if (BootLoader.getOS().equals(BootLoader.OS_WIN32))
+               if (Platform.getOS().equals(Platform.OS_WIN32))
                        aPath = "\"" + aPath + "\"";
 
                return aPath;
@@ -85,6 +86,5 @@ public class InterpreterRunner {
        
        protected String getDebugCommandLineArgument() {
                return "" ;     
-       }
-       
+       }       
 }