1 package net.sourceforge.phpdt.internal.launching;
 
   5 import net.sourceforge.phpeclipse.resourcesview.PHPProject;
 
   6 import org.eclipse.core.resources.IProject;
 
   7 import org.eclipse.core.runtime.CoreException;
 
   8 import org.eclipse.core.runtime.IPath;
 
   9 import org.eclipse.core.runtime.Path;
 
  10 import org.eclipse.debug.core.ILaunchConfiguration;
 
  12 public class InterpreterRunnerConfiguration {
 
  13         protected ILaunchConfiguration configuration;
 
  15         public InterpreterRunnerConfiguration(ILaunchConfiguration aConfiguration) {
 
  16                 configuration = aConfiguration;
 
  19         public String getAbsoluteFileName() {
 
  20                 IPath path = new Path(getFileName());
 
  21                 IProject project = getProject().getProject();
 
  23                 return project.getLocation().toOSString() + "/" + getFileName();
 
  26         public String getFileName() {
 
  30                         fileName = configuration.getAttribute(PHPLaunchConfigurationAttribute.FILE_NAME, "No file specified in configuration");
 
  31                 } catch(CoreException e) {}
 
  33                 return fileName.replace('\\', '/');
 
  36         public PHPProject getProject() {
 
  37                 String projectName = "";
 
  40                         projectName = configuration.getAttribute(PHPLaunchConfigurationAttribute.PROJECT_NAME, "");
 
  41                 } catch(CoreException e) {
 
  42                         PHPLaunchingPlugin.getDefault().log(e);
 
  45                 IProject project = PHPLaunchingPlugin.getWorkspace().getRoot().getProject(projectName);
 
  47                 PHPProject phpProject = new PHPProject();
 
  48                 phpProject.setProject(project);
 
  52         public File getAbsoluteWorkingDirectory() {
 
  55                         file = configuration.getAttribute(PHPLaunchConfigurationAttribute.WORKING_DIRECTORY, "");
 
  56                 } catch(CoreException e) {
 
  57                         PHPLaunchingPlugin.log(e);
 
  59                 return new File(file);
 
  62         public String getInterpreterArguments() {
 
  64                         return configuration.getAttribute(PHPLaunchConfigurationAttribute.INTERPRETER_ARGUMENTS, "");
 
  65                 } catch(CoreException e) {}
 
  70         public String getProgramArguments() {
 
  72                         return configuration.getAttribute(PHPLaunchConfigurationAttribute.PROGRAM_ARGUMENTS, "");
 
  73                 } catch (CoreException e) {}
 
  78         public PHPInterpreter getInterpreter() {
 
  79                 String selectedInterpreter = null;
 
  81                         selectedInterpreter = configuration.getAttribute(PHPLaunchConfigurationAttribute.SELECTED_INTERPRETER, "");
 
  82                 } catch(CoreException e) {}
 
  84                 return PHPRuntime.getDefault().getInterpreter(selectedInterpreter);