1 package net.sourceforge.phpdt.internal.launching;
5 import net.sourceforge.phpdt.internal.core.JavaProject;
7 import org.eclipse.core.resources.IProject;
8 import org.eclipse.core.runtime.CoreException;
9 import org.eclipse.core.runtime.IPath;
10 import org.eclipse.core.runtime.Path;
11 import org.eclipse.debug.core.ILaunchConfiguration;
13 public class InterpreterRunnerConfiguration {
14 protected ILaunchConfiguration configuration;
16 public InterpreterRunnerConfiguration(ILaunchConfiguration aConfiguration) {
17 configuration = aConfiguration;
20 public String getAbsoluteFileName() {
21 IPath path = new Path(getFileName());
22 IProject project = getProject().getProject();
24 return project.getLocation().toOSString() + "/" + getFileName();
27 public String getFileName() {
31 fileName = configuration.getAttribute(PHPLaunchConfigurationAttribute.FILE_NAME, "No file specified in configuration");
32 } catch(CoreException e) {}
34 return fileName.replace('\\', '/');
37 public JavaProject getProject() {
38 String projectName = "";
41 projectName = configuration.getAttribute(PHPLaunchConfigurationAttribute.PROJECT_NAME, "");
42 } catch(CoreException e) {
43 PHPLaunchingPlugin.log(e);
46 IProject project = PHPLaunchingPlugin.getWorkspace().getRoot().getProject(projectName);
48 JavaProject phpProject = new JavaProject();
49 phpProject.setProject(project);
53 public File getAbsoluteWorkingDirectory() {
56 file = configuration.getAttribute(PHPLaunchConfigurationAttribute.WORKING_DIRECTORY, "");
57 } catch(CoreException e) {
58 PHPLaunchingPlugin.log(e);
60 return new File(file);
63 public String getInterpreterArguments() {
65 return configuration.getAttribute(PHPLaunchConfigurationAttribute.INTERPRETER_ARGUMENTS, "");
66 } catch(CoreException e) {}
71 public String getProgramArguments() {
73 return configuration.getAttribute(PHPLaunchConfigurationAttribute.PROGRAM_ARGUMENTS, "");
74 } catch (CoreException e) {}
79 public PHPInterpreter getInterpreter() {
80 String selectedInterpreter = null;
82 selectedInterpreter = configuration.getAttribute(PHPLaunchConfigurationAttribute.SELECTED_INTERPRETER, "");
83 } catch(CoreException e) {}
85 return PHPRuntime.getDefault().getInterpreter(selectedInterpreter);
88 public boolean useRemoteDebugger() {
90 return configuration.getAttribute(PHPLaunchConfigurationAttribute.REMOTE_DEBUG, false);
91 } catch(CoreException e) {
92 PHPLaunchingPlugin.log(e);
97 public String getRemoteSourcePath() {
99 IProject project = getProject().getProject();
100 if (useRemoteDebugger())
101 return project.getLocation().toOSString();
105 return configuration.getAttribute(PHPLaunchConfigurationAttribute.REMOTE_PATH, "");
106 } catch(CoreException e) {
107 PHPLaunchingPlugin.log(e);