1 package net.sourceforge.phpdt.internal.debug.ui.launcher;
3 import org.eclipse.core.resources.IFile;
4 import org.eclipse.core.runtime.CoreException;
5 import org.eclipse.core.runtime.QualifiedName;
7 public class ExecutionArguments {
8 protected static final QualifiedName EXECUTION_ARGUMENTS_PROPERTY = new QualifiedName(
9 "net.sourceforge.phpdt", "executionArguments");
11 protected static final String ARGUMENT_SEPARATOR = "**<ArgBreak>**";
13 protected String interpreterArguments, phpFileArguments;
15 public static ExecutionArguments getExecutionArguments(IFile phpScriptFile) {
17 String executionArgumentsPersistableFormat = phpScriptFile
18 .getPersistentProperty(EXECUTION_ARGUMENTS_PROPERTY);
19 ExecutionArguments executionArguments = new ExecutionArguments();
21 if (executionArgumentsPersistableFormat != null) {
22 int argBreakIndex = executionArgumentsPersistableFormat
23 .indexOf(ARGUMENT_SEPARATOR);
25 .setInterpreterArguments(executionArgumentsPersistableFormat
26 .substring(0, argBreakIndex));
28 .setPHPFileArguments(executionArgumentsPersistableFormat
29 .substring(argBreakIndex
30 + ARGUMENT_SEPARATOR.length()));
33 return executionArguments;
34 } catch (CoreException e) {
40 public static void setExecutionArguments(IFile phpScriptFile,
41 ExecutionArguments arguments) {
43 phpScriptFile.setPersistentProperty(EXECUTION_ARGUMENTS_PROPERTY,
44 arguments.toPersistableFormat());
45 } catch (CoreException e) {
49 public void setInterpreterArguments(String theArguments) {
50 interpreterArguments = theArguments;
53 public void setPHPFileArguments(String theArguments) {
54 phpFileArguments = theArguments;
57 public String toPersistableFormat() {
58 return interpreterArguments + ARGUMENT_SEPARATOR + phpFileArguments;