2 * Created on 12.02.2004
4 * To change the template for this generated file go to
5 * Window>Preferences>Java>Code Generation>Code and Comments
7 package net.sourceforge.phpdt.internal.debug.ui.preferences;
9 import net.sourceforge.phpdt.internal.debug.ui.PHPDebugUiMessages;
10 import net.sourceforge.phpdt.internal.ui.dialogs.StatusDialog;
12 import org.eclipse.swt.SWT;
13 import org.eclipse.swt.events.SelectionAdapter;
14 import org.eclipse.swt.events.SelectionEvent;
15 import org.eclipse.swt.layout.GridData;
16 import org.eclipse.swt.layout.GridLayout;
17 import org.eclipse.swt.widgets.Button;
18 import org.eclipse.swt.widgets.Composite;
19 import org.eclipse.swt.widgets.Control;
20 import org.eclipse.swt.widgets.DirectoryDialog;
21 import org.eclipse.swt.widgets.Label;
22 import org.eclipse.swt.widgets.Shell;
23 import org.eclipse.swt.widgets.Text;
28 * To change the template for this generated type comment go to
29 * Window>Preferences>Java>Code Generation>Code and Comments
31 public class EditPathMapDialog extends StatusDialog {
33 private Text fLocalPathText;
35 private Text fRemotePathText;
37 private String[] fInitialValues;
39 private String fLocalPath;
41 private String fRemotePath;
43 public EditPathMapDialog(Shell parentShell, String aDialogTitle,
44 String[] initialValues) {
46 setTitle(aDialogTitle);
47 fInitialValues = initialValues;
50 protected void okPressed() {
51 fLocalPath = fLocalPathText.getText();
52 fRemotePath = fRemotePathText.getText();
56 protected Control createDialogArea(Composite composite) {
57 Composite comp = new Composite(composite, SWT.NONE);
58 comp.setLayout(new GridLayout());
60 Composite fileComp = new Composite(comp, SWT.NONE);
61 GridLayout gridLayout = new GridLayout();
62 gridLayout.numColumns = 3;
63 // gridLayout.marginHeight = 0;
64 // gridLayout.marginWidth = 0;
65 fileComp.setLayout(gridLayout);
67 Label label = new Label(fileComp, SWT.NONE);
69 .setText(PHPDebugUiMessages
70 .getString("EditPathDialog.Local_Path"));//$NON-NLS-1$
72 fLocalPathText = new Text(fileComp, SWT.SINGLE | SWT.BORDER);
73 GridData gd = new GridData();
75 fLocalPathText.setLayoutData(gd);
76 fLocalPathText.setText(fInitialValues[0]);
77 Button button = new Button(fileComp, SWT.PUSH);
79 .setText(PHPDebugUiMessages
80 .getString("EditPathMapDialog.Browse")); //$NON-NLS-1$
81 button.addSelectionListener(new SelectionAdapter() {
82 public void widgetSelected(SelectionEvent e) {
83 handleBrowseButtonSelected();
86 label = new Label(fileComp, SWT.NONE);
87 label.setText(PHPDebugUiMessages
88 .getString("EditPathMapDialog.Remote_Path")); //$NON-NLS-1$
89 fRemotePathText = new Text(fileComp, SWT.SINGLE | SWT.BORDER);
90 fRemotePathText.setText(fInitialValues[1]);
91 gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
92 gd.horizontalSpan = 2;
93 fRemotePathText.setLayoutData(gd);
98 public String[] getPathPair() {
99 return new String[] { fLocalPath, fRemotePath };
102 private void handleBrowseButtonSelected() {
103 DirectoryDialog dd = new DirectoryDialog(getShell(), SWT.OPEN);
104 dd.setMessage(PHPDebugUiMessages
105 .getString("EditPathMapDialog.Select_the_directory_to_map")); //$NON-NLS-1$
106 String path = dd.open();
109 fLocalPathText.setText(path);