removed unused dependency
[phpeclipse.git] / net.sourceforge.phpeclipse.launching / src / net / sourceforge / phpdt / internal / launching / PHPInterpreter.java
1 package net.sourceforge.phpdt.internal.launching;
2
3 import java.io.File;
4 import java.io.IOException;
5
6 public class PHPInterpreter {
7
8   protected File installLocation;
9
10   public PHPInterpreter(File interpreter) {
11     installLocation = interpreter;
12   }
13
14   public File getInstallLocation() {
15     return installLocation;
16   }
17
18   public void setInstallLocation(File interpreter) {
19     installLocation = interpreter;
20   }
21
22   public String getCommand() {
23     return installLocation.toString();
24   }
25
26 //  private boolean executePHPProcess(String arguments, File workingDirectory, String[] env) {
27 //    Process process = null;
28 //    try {
29 //      StringBuffer buf = new StringBuffer();
30 //      buf.append(getCommand() + " " + arguments);
31 //      process = Runtime.getRuntime().exec(buf.toString(), env, workingDirectory);
32 //      if (process != null) {
33 //        // construct a formatted command line for the process properties
34 //
35 //        //                    for (int i= 0; i < args.length; i++) {
36 //        //                            buf.append(args[i]);
37 //        //                            buf.append(' ');
38 //        //                    }
39 //
40 //        ILaunchConfigurationWorkingCopy wc = null;
41 //        try {
42 //          ILaunchConfigurationType lcType = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(
43 //              PHPLaunchConfigurationAttribute.PHP_LAUNCH_CONFIGURATION_TYPE);
44 //          String name = "PHP Launcher"; //$NON-NLS-1$
45 //          wc = lcType.newInstance(null, name);
46 //          wc.setAttribute(IDebugUIConstants.ATTR_FAVORITE_GROUPS, true);
47 //
48 //          ILaunch newLaunch = new Launch(wc, ILaunchManager.RUN_MODE, null);
49 //          IProcess iprocess = DebugPlugin.newProcess(newLaunch, process, "PHP Process"); //$NON-NLS-1$
50 //          iprocess.setAttribute(IProcess.ATTR_CMDLINE, buf.toString());
51 //          iprocess.setAttribute(IProcess.ATTR_PROCESS_TYPE, PHPLaunchConfigurationAttribute.PHP_LAUNCH_PROCESS_TYPE);
52 //
53 //          DebugPlugin.getDefault().getLaunchManager().addLaunch(newLaunch);
54 //
55 //        } catch (CoreException e) {
56 //        }
57 //
58 //        return true;
59 //
60 //      }
61 //    } catch (IOException e) {
62 //      return false;
63 //    }
64 //    return false;
65 //
66 //  }
67
68   public Process exec(String arguments, File workingDirectory, String[] env) throws IOException {
69     return Runtime.getRuntime().exec(getCommand() + " " + arguments, env, workingDirectory);
70     //    executePHPProcess(arguments, workingDirectory, env);
71   }
72
73   public boolean equals(Object other) {
74     if (other instanceof PHPInterpreter) {
75       PHPInterpreter otherInterpreter = (PHPInterpreter) other;
76       return installLocation.equals(otherInterpreter.getInstallLocation());
77     }
78     return false;
79   }
80 }