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("net.sourceforge.phpdt", "executionArguments");
9 protected static final String ARGUMENT_SEPARATOR = "**<ArgBreak>**";
11 protected String interpreterArguments, phpFileArguments;
13 public static ExecutionArguments getExecutionArguments(IFile phpScriptFile) {
15 String executionArgumentsPersistableFormat = phpScriptFile.getPersistentProperty(EXECUTION_ARGUMENTS_PROPERTY);
16 ExecutionArguments executionArguments = new ExecutionArguments();
18 if (executionArgumentsPersistableFormat != null) {
19 int argBreakIndex = executionArgumentsPersistableFormat.indexOf(ARGUMENT_SEPARATOR);
20 executionArguments.setInterpreterArguments(executionArgumentsPersistableFormat.substring(0, argBreakIndex));
21 executionArguments.setPHPFileArguments(executionArgumentsPersistableFormat.substring(argBreakIndex + ARGUMENT_SEPARATOR.length()));
24 return executionArguments;
25 } catch (CoreException e) {}
30 public static void setExecutionArguments(IFile phpScriptFile, ExecutionArguments arguments) {
32 phpScriptFile.setPersistentProperty(EXECUTION_ARGUMENTS_PROPERTY, arguments.toPersistableFormat());
33 } catch (CoreException e) {}
36 public void setInterpreterArguments(String theArguments) {
37 interpreterArguments = theArguments;
40 public void setPHPFileArguments(String theArguments) {
41 phpFileArguments = theArguments;
44 public String toPersistableFormat() {
45 return interpreterArguments + ARGUMENT_SEPARATOR + phpFileArguments;