1 package net.sourceforge.phpdt.internal.debug.ui;
3 import org.eclipse.core.resources.IFile;
4 import org.eclipse.core.runtime.CoreException;
5 import org.eclipse.core.runtime.QualifiedName;
6 import org.eclipse.swt.SWT;
7 import org.eclipse.swt.layout.GridData;
8 import org.eclipse.swt.layout.GridLayout;
9 import org.eclipse.swt.widgets.Composite;
10 import org.eclipse.swt.widgets.Control;
11 import org.eclipse.swt.widgets.Label;
12 import org.eclipse.swt.widgets.Text;
13 import org.eclipse.ui.IWorkbenchPropertyPage;
14 import org.eclipse.ui.dialogs.PropertyPage;
16 public class PHPExecutionArgumentsPage extends PropertyPage implements
17 IWorkbenchPropertyPage {
18 protected Text interpreterArgumentsText, programArgumentsText;
20 public PHPExecutionArgumentsPage() {
23 protected Control createContents(Composite parent) {
24 noDefaultAndApplyButton();
26 Composite composite = new Composite(parent, SWT.NONE);
28 GridLayout layout = new GridLayout();
29 layout.numColumns = 2;
30 composite.setLayout(layout);
31 new Label(composite, SWT.NONE)
32 .setText(PHPDebugUiMessages
33 .getString("LaunchConfigurationTab.PHPArguments.interpreter_args_box_title"));
34 new Label(composite, SWT.NONE).setText(" ");
35 interpreterArgumentsText = new Text(composite, SWT.BORDER);
36 GridData interpreterArgumentsData = new GridData(
37 GridData.HORIZONTAL_ALIGN_FILL);
38 interpreterArgumentsData.horizontalSpan = 2;
39 interpreterArgumentsText.setLayoutData(interpreterArgumentsData);
40 interpreterArgumentsText.setText(getArgument("interpreter"));
42 new Label(composite, SWT.NONE)
43 .setText(PHPDebugUiMessages
44 .getString("LaunchConfigurationTab.PHPArguments.program_args_box_title"));
45 programArgumentsText = new Text(composite, SWT.BORDER);
46 GridData programArgumentsData = new GridData(
47 GridData.HORIZONTAL_ALIGN_FILL);
48 programArgumentsData.horizontalSpan = 2;
49 programArgumentsText.setLayoutData(programArgumentsData);
50 programArgumentsText.setText(getArgument("program"));
55 protected String getArgument(String name) {
56 String argumentValue = null;
58 argumentValue = ((IFile) getElement())
59 .getPersistentProperty(new QualifiedName(
60 "executionArguments", name));
61 } catch (CoreException e) {
64 return argumentValue != null ? argumentValue : "";
67 public boolean performOk() {
68 IFile phpFile = (IFile) getElement();
70 phpFile.setPersistentProperty(new QualifiedName(
71 "executionArguments", "interpreter"),
72 interpreterArgumentsText.getText());
73 phpFile.setPersistentProperty(new QualifiedName(
74 "executionArguments", "program"), programArgumentsText
76 } catch (CoreException e) {
77 PHPDebugUiPlugin.log(e);