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.ui.dialogs.StatusDialog;
10 import net.sourceforge.phpdt.internal.debug.ui.PHPDebugUiMessages;
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.FileDialog;
22 import org.eclipse.swt.widgets.Label;
23 import org.eclipse.swt.widgets.Shell;
24 import org.eclipse.swt.widgets.Text;
29 * To change the template for this generated type comment go to
30 * Window>Preferences>Java>Code Generation>Code and Comments
32 public class EditPathMapDialog extends StatusDialog {
35 private Text fLocalPathText;
36 private Text fRemotePathText;
37 private String[] fInitialValues;
38 private String fLocalPath;
39 private String fRemotePath;
41 public EditPathMapDialog(Shell parentShell, String aDialogTitle, String[] initialValues) {
43 setTitle(aDialogTitle);
44 fInitialValues= initialValues;
47 protected void okPressed() {
48 fLocalPath= fLocalPathText.getText();
49 fRemotePath = fRemotePathText.getText();
52 protected Control createDialogArea(Composite composite) {
53 Composite comp = new Composite(composite, SWT.NONE);
54 comp.setLayout(new GridLayout());
56 Composite fileComp= new Composite(comp,SWT.NONE);
57 GridLayout gridLayout = new GridLayout();
58 gridLayout.numColumns = 3;
59 // gridLayout.marginHeight = 0;
60 // gridLayout.marginWidth = 0;
61 fileComp.setLayout(gridLayout);
63 Label label= new Label(fileComp,SWT.NONE);
64 label.setText(PHPDebugUiMessages.getString("EditPathDialog.Local_Path"));//$NON-NLS-1$
67 fLocalPathText = new Text(fileComp,SWT.SINGLE | SWT.BORDER);
68 GridData gd = new GridData();
70 fLocalPathText.setLayoutData(gd);
71 fLocalPathText.setText(fInitialValues[0]);
72 Button button= new Button(fileComp, SWT.PUSH);
73 button.setText(PHPDebugUiMessages.getString("EditPathMapDialog.Browse")); //$NON-NLS-1$
74 button.addSelectionListener(new SelectionAdapter() {
75 public void widgetSelected(SelectionEvent e) {
76 handleBrowseButtonSelected();
79 label= new Label(fileComp,SWT.NONE);
80 label.setText(PHPDebugUiMessages.getString("EditPathMapDialog.Remote_Path")); //$NON-NLS-1$
81 fRemotePathText = new Text(fileComp,SWT.SINGLE | SWT.BORDER);
82 fRemotePathText.setText(fInitialValues[1]);
83 gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
84 gd.horizontalSpan = 2;
85 fRemotePathText.setLayoutData(gd);
90 public String[] getPathPair() {
91 return new String[] {fLocalPath,fRemotePath};
95 private void handleBrowseButtonSelected() {
96 DirectoryDialog dd = new DirectoryDialog(getShell(),SWT.OPEN);
97 dd.setMessage(PHPDebugUiMessages.getString("EditPathMapDialog.Select_the_directory_to_map")); //$NON-NLS-1$
98 String path=dd.open();
101 fLocalPathText.setText(path);