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 IWorkbenchPropertyPage {
17 protected Text interpreterArgumentsText, programArgumentsText;
19 public PHPExecutionArgumentsPage() {
22 protected Control createContents(Composite parent) {
23 noDefaultAndApplyButton();
25 Composite composite = new Composite(parent, SWT.NONE);
27 GridLayout layout = new GridLayout();
28 layout.numColumns = 2;
29 composite.setLayout(layout);
30 new Label(composite, SWT.NONE).setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPArguments.interpreter_args_box_title"));
31 new Label(composite, SWT.NONE).setText(" ");
32 interpreterArgumentsText = new Text(composite, SWT.BORDER);
33 GridData interpreterArgumentsData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
34 interpreterArgumentsData.horizontalSpan = 2;
35 interpreterArgumentsText.setLayoutData(interpreterArgumentsData);
36 interpreterArgumentsText.setText(getArgument("interpreter"));
38 new Label(composite, SWT.NONE).setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPArguments.program_args_box_title"));
39 programArgumentsText = new Text(composite, SWT.BORDER);
40 GridData programArgumentsData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
41 programArgumentsData.horizontalSpan = 2;
42 programArgumentsText.setLayoutData(programArgumentsData);
43 programArgumentsText.setText(getArgument("program"));
48 protected String getArgument(String name) {
49 String argumentValue = null;
51 argumentValue = ((IFile)getElement()).getPersistentProperty(new QualifiedName("executionArguments", name));
52 } catch(CoreException e) {}
54 return argumentValue != null ? argumentValue : "";
57 public boolean performOk() {
58 IFile phpFile = (IFile)getElement();
60 phpFile.setPersistentProperty(new QualifiedName("executionArguments", "interpreter"), interpreterArgumentsText.getText());
61 phpFile.setPersistentProperty(new QualifiedName("executionArguments", "program"), programArgumentsText.getText());
62 } catch(CoreException e) {
63 PHPDebugUiPlugin.log(e);