1 package net.sourceforge.phpdt.internal.debug.ui.launcher;
3 import java.util.ArrayList;
4 import java.util.HashMap;
5 import java.util.Iterator;
8 import net.sourceforge.phpdt.internal.debug.ui.PHPDebugUiMessages;
9 import net.sourceforge.phpdt.internal.debug.ui.PHPDebugUiPlugin;
10 import net.sourceforge.phpdt.internal.debug.ui.preferences.EditInterpreterDialog;
11 import net.sourceforge.phpdt.internal.debug.ui.preferences.EditPathMapDialog;
12 import net.sourceforge.phpdt.internal.launching.PHPInterpreter;
13 import net.sourceforge.phpdt.internal.launching.PHPLaunchConfigurationAttribute;
14 import net.sourceforge.phpdt.internal.launching.PHPRuntime;
15 import net.sourceforge.phpdt.internal.ui.PHPUiImages;
17 import org.eclipse.core.runtime.CoreException;
18 import org.eclipse.debug.core.ILaunchConfiguration;
19 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
20 import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
21 import org.eclipse.jface.viewers.ColumnWeightData;
22 import org.eclipse.jface.viewers.ListViewer;
23 import org.eclipse.jface.viewers.TableLayout;
24 import org.eclipse.swt.SWT;
25 import org.eclipse.swt.events.ModifyEvent;
26 import org.eclipse.swt.events.ModifyListener;
27 import org.eclipse.swt.events.MouseAdapter;
28 import org.eclipse.swt.events.MouseEvent;
29 import org.eclipse.swt.events.SelectionAdapter;
30 import org.eclipse.swt.events.SelectionEvent;
31 import org.eclipse.swt.events.SelectionListener;
32 import org.eclipse.swt.graphics.Image;
33 import org.eclipse.swt.layout.GridData;
34 import org.eclipse.swt.layout.GridLayout;
35 import org.eclipse.swt.widgets.Button;
36 import org.eclipse.swt.widgets.Combo;
37 import org.eclipse.swt.widgets.Composite;
38 import org.eclipse.swt.widgets.Label;
39 import org.eclipse.swt.widgets.TabFolder;
40 import org.eclipse.swt.widgets.TabItem;
41 import org.eclipse.swt.widgets.Table;
42 import org.eclipse.swt.widgets.TableColumn;
43 import org.eclipse.swt.widgets.TableItem;
44 import org.eclipse.swt.widgets.Text;
46 public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab {
47 protected ListViewer loadPathListViewer;
49 protected java.util.List installedInterpretersWorkingCopy;
51 protected Combo interpreterCombo;
53 // protected Button loadPathDefaultButton;
54 protected Button fRemoteDebugCheckBox;
56 protected Button fOpenDBGSessionInBrowserCheckBox;
58 protected Button fPathMapRemoveButton;
60 protected Button fPathMapAddButton;
62 protected Button fPathMapEditButton;
64 protected Text fRemoteSourcePath;
66 protected Table fRemoteDebugPathMapTable;
68 protected TabFolder tabFolder;
70 private class RemoteDebugTabListener extends SelectionAdapter implements ModifyListener {
75 * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
77 public void modifyText(ModifyEvent e) {
78 updateLaunchConfigurationDialog();
84 * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
86 public void widgetSelected(SelectionEvent e) {
87 Object source = e.getSource();
88 if (source == fRemoteDebugPathMapTable) {
89 setPathMapButtonsEnableState();
90 } else if (source == fPathMapAddButton) {
91 handlePathMapAddButtonSelected();
92 } else if (source == fPathMapEditButton) {
93 handlePathMapEditButtonSelected();
94 } else if (source == fPathMapRemoveButton) {
95 handlePathMapRemoveButtonSelected();
96 } else if (source == fRemoteDebugCheckBox) {
97 setRemoteTabEnableState();
99 updateLaunchConfigurationDialog();
107 private static final String EMPTY_STRING = ""; //$NON-NLS-1$
109 private RemoteDebugTabListener fListener = new RemoteDebugTabListener();
111 private static final boolean DEFAULT_REMOTE_DEBUG = false;
113 private static final boolean DEFAULT_OPEN_DBGSESSION_IN_BROWSER = true;
115 static String[] columnTitles = {
116 PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMapTableTitle.local"),
117 PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMapTableTitle.remote") };
119 public PHPEnvironmentTab() {
123 public void createControl(Composite parent) {
124 Composite composite = createPageRoot(parent);
126 tabFolder = new TabFolder(composite, SWT.NONE);
127 GridData gridData = new GridData(GridData.FILL_BOTH);
128 tabFolder.setLayoutData(gridData);
130 // addLoadPathTab(tabFolder);
131 addInterpreterTab(tabFolder);
132 addRemoteDebugTab(tabFolder);
135 protected void addRemoteDebugTab(TabFolder tabFolder) {
138 TabItem remoteDebugTab = new TabItem(tabFolder, SWT.NONE, 0);
139 remoteDebugTab.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.label"));
141 Composite comp = new Composite(tabFolder, SWT.NONE);
142 comp.setLayout(new GridLayout());
143 remoteDebugTab.setControl(comp);
146 fRemoteDebugCheckBox = new Button(comp, SWT.CHECK);
147 fRemoteDebugCheckBox.setText(PHPDebugUiMessages
148 .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.RemoteCheckBox.label"));
149 fRemoteDebugCheckBox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
150 fRemoteDebugCheckBox.addSelectionListener(fListener);
152 fOpenDBGSessionInBrowserCheckBox = new Button(comp, SWT.CHECK);
153 fOpenDBGSessionInBrowserCheckBox.setText(PHPDebugUiMessages
154 .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.OpenDBGSessionInBrowserCheckBox.label"));
155 fOpenDBGSessionInBrowserCheckBox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
156 fOpenDBGSessionInBrowserCheckBox.addSelectionListener(fListener);
158 label = new Label(comp, SWT.NONE);
159 label.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.RemoteSourcePath.label"));
160 fRemoteSourcePath = new Text(comp, SWT.BORDER | SWT.SINGLE);
161 gd = new GridData(GridData.FILL_HORIZONTAL);
162 fRemoteSourcePath.setLayoutData(gd);
163 fRemoteSourcePath.addModifyListener(fListener);
165 createVerticalSpacer(comp, 1);
167 Composite pathMapComp = new Composite(comp, SWT.NONE);
168 gd = new GridData(GridData.FILL_BOTH);
169 pathMapComp.setLayoutData(gd);
170 GridLayout parametersLayout = new GridLayout();
171 parametersLayout.numColumns = 2;
172 parametersLayout.marginHeight = 0;
173 parametersLayout.marginWidth = 0;
174 pathMapComp.setLayout(parametersLayout);
176 Label pathMapLabel = new Label(pathMapComp, SWT.NONE);
177 pathMapLabel.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.label"));
179 gd.horizontalSpan = 2;
180 pathMapLabel.setLayoutData(gd);
182 fRemoteDebugPathMapTable = new Table(pathMapComp, SWT.BORDER | SWT.MULTI);
183 TableLayout tableLayout = new TableLayout();
184 fRemoteDebugPathMapTable.setLayout(tableLayout);
186 gd = new GridData(GridData.FILL_BOTH);
187 fRemoteDebugPathMapTable.setLayoutData(gd);
188 TableColumn column1 = new TableColumn(this.fRemoteDebugPathMapTable, SWT.NONE);
189 column1.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.Table.Title.local")); //$NON-NLS-1$
190 TableColumn column2 = new TableColumn(this.fRemoteDebugPathMapTable, SWT.NONE);
192 .setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.Table.Title.remote")); //$NON-NLS-1$
193 tableLayout.addColumnData(new ColumnWeightData(100));
194 tableLayout.addColumnData(new ColumnWeightData(100));
195 fRemoteDebugPathMapTable.setHeaderVisible(true);
196 fRemoteDebugPathMapTable.setLinesVisible(true);
197 fRemoteDebugPathMapTable.addSelectionListener(fListener);
198 fRemoteDebugPathMapTable.addMouseListener(new MouseAdapter() {
199 public void mouseDoubleClick(MouseEvent e) {
200 setPathMapButtonsEnableState();
201 if (fPathMapEditButton.isEnabled()) {
202 handlePathMapEditButtonSelected();
206 // fRemoteDebugPathMapTable.setEnabled(false);
208 Composite envButtonComp = new Composite(pathMapComp, SWT.NONE);
209 GridLayout envButtonLayout = new GridLayout();
210 envButtonLayout.marginHeight = 0;
211 envButtonLayout.marginWidth = 0;
212 envButtonComp.setLayout(envButtonLayout);
213 gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL);
214 envButtonComp.setLayoutData(gd);
216 fPathMapAddButton = createPushButton(envButtonComp, PHPDebugUiMessages
217 .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.Button.Add.label"), null); //$NON-NLS-1$
218 fPathMapAddButton.addSelectionListener(fListener);
219 // fPathMapAddButton.setEnabled(false);
221 fPathMapEditButton = createPushButton(envButtonComp, PHPDebugUiMessages
222 .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.Button.Edit.label"), null); //$NON-NLS-1$
223 fPathMapEditButton.addSelectionListener(fListener);
224 // fPathMapEditButton.setEnabled(false);
226 fPathMapRemoveButton = createPushButton(envButtonComp, PHPDebugUiMessages
227 .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.Button.Remove.label"), null); //$NON-NLS-1$
228 fPathMapRemoveButton.addSelectionListener(fListener);
229 // fPathMapRemoveButton.setEnabled(false);
233 void handlePathMapAddButtonSelected() {
234 EditPathMapDialog dialog = new EditPathMapDialog(getShell(), "Edit File Map", new String[] { EMPTY_STRING, EMPTY_STRING });
235 openNewPathMapDialog(dialog, null);
237 // if (dialog.open()==EditPathMapDialog.OK)
239 // TableItem item = new TableItem (fRemoteDebugPathMapTable, SWT.NONE);
240 // item.setText(0,dialog.getLocalPath());
241 // item.setText(1,dialog.getRemotePath());
242 // updateLaunchConfigurationDialog();
244 // updateLaunchConfigurationDialog();
245 setPathMapButtonsEnableState();
248 void handlePathMapRemoveButtonSelected() {
249 int[] selectedIndices = this.fRemoteDebugPathMapTable.getSelectionIndices();
250 this.fRemoteDebugPathMapTable.remove(selectedIndices);
251 setPathMapButtonsEnableState();
252 updateLaunchConfigurationDialog();
255 void handlePathMapEditButtonSelected() {
256 TableItem selectedItem = this.fRemoteDebugPathMapTable.getSelection()[0];
257 String local = selectedItem.getText(0);
258 String remote = selectedItem.getText(1);
259 EditPathMapDialog dialog = new EditPathMapDialog(getShell(), "Edit File Map", new String[] { local, remote });
260 openNewPathMapDialog(dialog, selectedItem);
264 * Set the enabled state of whole tab.
266 private void setRemoteTabEnableState() {
267 boolean state = fRemoteDebugCheckBox.getSelection();
268 fRemoteSourcePath.setEnabled(state);
270 fRemoteDebugPathMapTable.setEnabled(state);
272 fPathMapEditButton.setEnabled(false);
273 fPathMapRemoveButton.setEnabled(false);
274 fPathMapAddButton.setEnabled(false);
275 fOpenDBGSessionInBrowserCheckBox.setEnabled(false);
277 setPathMapButtonsEnableState();
280 updateLaunchConfigurationDialog();
284 * Set the enabled state of the three environment variable-related buttons based on the selection in the PathMapTable widget.
286 private void setPathMapButtonsEnableState() {
287 // just do nothing for now
289 if (fRemoteDebugCheckBox.getSelection()) {
290 fOpenDBGSessionInBrowserCheckBox.setEnabled(true);
291 int selectCount = this.fRemoteDebugPathMapTable.getSelectionIndices().length;
292 if (selectCount < 1) {
293 fPathMapEditButton.setEnabled(false);
294 fPathMapRemoveButton.setEnabled(false);
296 fPathMapRemoveButton.setEnabled(true);
297 if (selectCount == 1) {
298 fPathMapEditButton.setEnabled(true);
300 fPathMapEditButton.setEnabled(false);
303 fPathMapAddButton.setEnabled(true);
308 * Show the specified dialog and update the pathMapTable table based on its results.
311 * the item to update, or <code>null</code> if adding a new item
313 private void openNewPathMapDialog(EditPathMapDialog dialog, TableItem updateItem) {
314 if (dialog.open() != EditPathMapDialog.OK) {
317 String[] pathPair = dialog.getPathPair();
318 TableItem tableItem = updateItem;
319 if (tableItem == null) {
320 tableItem = getTableItemForName(pathPair[0]);
321 if (tableItem == null) {
322 tableItem = new TableItem(this.fRemoteDebugPathMapTable, SWT.NONE);
325 tableItem.setText(pathPair);
326 this.fRemoteDebugPathMapTable.setSelection(new TableItem[] { tableItem });
327 updateLaunchConfigurationDialog();
331 * Helper method that indicates whether the specified parameter name is already present in the parameters table.
333 private TableItem getTableItemForName(String candidateName) {
334 TableItem[] items = this.fRemoteDebugPathMapTable.getItems();
335 for (int i = 0; i < items.length; i++) {
336 String name = items[i].getText(0);
337 if (name.equals(candidateName)) {
344 // protected void addLoadPathTab(TabFolder tabFolder) {
345 // Composite loadPathComposite = new Composite(tabFolder, SWT.NONE);
346 // loadPathComposite.setLayout(new GridLayout());
348 // loadPathListViewer = new ListViewer(loadPathComposite, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
349 // loadPathListViewer.setContentProvider(new ListContentProvider());
350 // loadPathListViewer.setLabelProvider(new LoadPathEntryLabelProvider());
351 // loadPathListViewer.getList().setLayoutData(new GridData(GridData.FILL_BOTH));
353 // TabItem loadPathTab = new TabItem(tabFolder, SWT.NONE, 0);
354 // loadPathTab.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.loadPathTab.label"));
355 // loadPathTab.setControl(loadPathComposite);
356 // loadPathTab.setData(loadPathListViewer);
358 // loadPathDefaultButton = new Button(loadPathComposite, SWT.CHECK);
359 // loadPathDefaultButton.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.loadPathDefaultButton.label"));
360 // loadPathDefaultButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
361 // loadPathDefaultButton.addSelectionListener(getLoadPathDefaultButtonSelectionListener());
363 // loadPathDefaultButton.setEnabled(false); //for now, until the load path is customizable on the configuration
366 protected SelectionListener getLoadPathSelectionListener() {
367 return new SelectionAdapter() {
368 public void widgetSelected(SelectionEvent e) {
369 System.out.println("Loadpath list selection occurred: " + e.getSource());
374 protected SelectionListener getLoadPathDefaultButtonSelectionListener() {
375 return new SelectionAdapter() {
376 public void widgetSelected(SelectionEvent e) {
377 setUseLoadPathDefaults(((Button) e.getSource()).getSelection());
382 protected void addInterpreterTab(TabFolder tabFolder) {
383 Composite interpreterComposite = new Composite(tabFolder, SWT.NONE);
384 GridLayout layout = new GridLayout();
385 layout.numColumns = 2;
386 layout.marginHeight = 0;
387 layout.marginWidth = 0;
388 interpreterComposite.setLayout(layout);
389 interpreterComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
391 createVerticalSpacer(interpreterComposite, 2);
393 interpreterCombo = new Combo(interpreterComposite, SWT.READ_ONLY);
394 interpreterCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
395 initializeInterpreterCombo(interpreterCombo);
396 interpreterCombo.addModifyListener(getInterpreterComboModifyListener());
398 Button interpreterAddButton = new Button(interpreterComposite, SWT.PUSH);
399 interpreterAddButton.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.interpreterAddButton.label"));
400 interpreterAddButton.addSelectionListener(new SelectionAdapter() {
401 public void widgetSelected(SelectionEvent evt) {
402 PHPInterpreter newInterpreter = new PHPInterpreter(null, null);
403 EditInterpreterDialog editor = new EditInterpreterDialog(getShell(), PHPDebugUiMessages
404 .getString("LaunchConfigurationTab.PHPEnvironment.editInterpreterDialog.title"));
406 editor.setInterpreterToEdit(newInterpreter);
407 if (EditInterpreterDialog.OK == editor.open()) {
408 PHPRuntime.getDefault().addInstalledInterpreter(newInterpreter);
409 interpreterCombo.add(newInterpreter.getName());
410 interpreterCombo.select(interpreterCombo.indexOf(newInterpreter.getName()));
415 TabItem interpreterTab = new TabItem(tabFolder, SWT.NONE);
416 interpreterTab.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.interpreterTab.label"));
417 interpreterTab.setControl(interpreterComposite);
420 protected ModifyListener getInterpreterComboModifyListener() {
421 return new ModifyListener() {
422 public void modifyText(ModifyEvent evt) {
423 updateLaunchConfigurationDialog();
428 protected void createVerticalSpacer(Composite comp, int colSpan) {
429 Label label = new Label(comp, SWT.NONE);
430 GridData gd = new GridData();
431 gd.horizontalSpan = colSpan;
432 label.setLayoutData(gd);
435 public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
438 public void initializeFrom(ILaunchConfiguration configuration) {
439 // initializeLoadPath(configuration);
440 initializeInterpreterSelection(configuration);
441 initializeRemoteDebug(configuration);
444 protected void initializeRemoteDebug(ILaunchConfiguration configuration) {
449 fRemoteDebugCheckBox.setSelection(configuration.getAttribute(PHPLaunchConfigurationAttribute.REMOTE_DEBUG,
450 DEFAULT_REMOTE_DEBUG));
451 } catch (CoreException ce) {
452 fRemoteDebugCheckBox.setSelection(DEFAULT_REMOTE_DEBUG);
455 fOpenDBGSessionInBrowserCheckBox.setSelection(configuration.getAttribute(
456 PHPLaunchConfigurationAttribute.OPEN_DBGSESSION_IN_BROWSER, DEFAULT_OPEN_DBGSESSION_IN_BROWSER));
457 } catch (CoreException ce) {
458 fOpenDBGSessionInBrowserCheckBox.setSelection(DEFAULT_OPEN_DBGSESSION_IN_BROWSER);
460 setRemoteTabEnableState();
462 fRemoteSourcePath.setText(configuration.getAttribute(PHPLaunchConfigurationAttribute.REMOTE_PATH, ""));
463 } catch (CoreException ce) {
464 fRemoteSourcePath.setText("");
467 updatePathMapFromConfig(configuration);
471 private void updatePathMapFromConfig(ILaunchConfiguration config) {
474 if (config != null) {
475 envVars = config.getAttribute(PHPLaunchConfigurationAttribute.FILE_MAP, (Map) null);
477 updatePathMapTable(envVars, this.fRemoteDebugPathMapTable);
478 setPathMapButtonsEnableState();
479 } catch (CoreException ce) {
484 private void updatePathMapTable(Map map, Table tableWidget) {
485 tableWidget.removeAll();
489 Iterator iterator = map.keySet().iterator();
490 while (iterator.hasNext()) {
491 String key = (String) iterator.next();
492 String value = (String) map.get(key);
493 TableItem tableItem = new TableItem(tableWidget, SWT.NONE);
494 tableItem.setText(new String[] { key, value });
498 // protected void initializeLoadPath(ILaunchConfiguration configuration) {
499 // boolean useDefaultLoadPath = true;
501 // useDefaultLoadPath = configuration.getAttribute(PHPLaunchConfigurationAttribute.USE_DEFAULT_LOAD_PATH, true);
502 // setUseLoadPathDefaults(useDefaultLoadPath);
503 // if (useDefaultLoadPath) {
504 // String projectName = configuration.getAttribute(PHPLaunchConfigurationAttribute.PROJECT_NAME, "");
505 // if (projectName != "") {
506 // IProject aProject = PHPeclipsePlugin.getWorkspace().getRoot().getProject(projectName);
507 // if ((aProject != null) && JavaCore.isPHPProject(aProject)) {
508 // JavaProject thePHPProject = new JavaProject();
509 // thePHPProject.setProject(aProject);
510 // List loadPathEntries = thePHPProject.getLoadPathEntries();
511 // loadPathListViewer.setInput(loadPathEntries);
515 // } catch (CoreException e) {
520 protected void setUseLoadPathDefaults(boolean useDefaults) {
521 loadPathListViewer.getList().setEnabled(!useDefaults);
522 // loadPathDefaultButton.setSelection(useDefaults);
525 protected void initializeInterpreterSelection(ILaunchConfiguration configuration) {
526 String interpreterName = null;
528 interpreterName = configuration.getAttribute(PHPLaunchConfigurationAttribute.SELECTED_INTERPRETER, "");
529 } catch (CoreException e) {
532 if (interpreterName != null && !interpreterName.equals(""))
533 interpreterCombo.select(interpreterCombo.indexOf(interpreterName));
536 protected void initializeInterpreterCombo(Combo interpreterCombo) {
537 installedInterpretersWorkingCopy = new ArrayList();
538 installedInterpretersWorkingCopy.addAll(PHPRuntime.getDefault().getInstalledInterpreters());
540 String[] interpreterNames = new String[installedInterpretersWorkingCopy.size()];
541 for (int interpreterIndex = 0; interpreterIndex < installedInterpretersWorkingCopy.size(); interpreterIndex++) {
542 PHPInterpreter interpreter = (PHPInterpreter) installedInterpretersWorkingCopy.get(interpreterIndex);
543 interpreterNames[interpreterIndex] = interpreter.getName();
545 interpreterCombo.setItems(interpreterNames);
547 PHPInterpreter selectedInterpreter = PHPRuntime.getDefault().getSelectedInterpreter();
548 if (selectedInterpreter != null)
549 interpreterCombo.select(interpreterCombo.indexOf(selectedInterpreter.getName()));
552 public void performApply(ILaunchConfigurationWorkingCopy configuration) {
553 int selectionIndex = interpreterCombo.getSelectionIndex();
554 if (selectionIndex >= 0)
555 configuration.setAttribute(PHPLaunchConfigurationAttribute.SELECTED_INTERPRETER, interpreterCombo.getItem(selectionIndex));
557 // configuration.setAttribute(PHPLaunchConfigurationAttribute.USE_DEFAULT_LOAD_PATH, loadPathDefaultButton.getSelection());
559 // if (!loadPathDefaultButton.getSelection()) {
560 // List loadPathEntries = (List) loadPathListViewer.getInput();
561 // List loadPathStrings = new ArrayList();
562 // for (Iterator iterator = loadPathEntries.iterator(); iterator.hasNext();) {
563 // LoadPathEntry entry = (LoadPathEntry) iterator.next();
564 // loadPathStrings.add(entry.getPath().toString());
566 // configuration.setAttribute(PHPLaunchConfigurationAttribute.CUSTOM_LOAD_PATH, loadPathStrings);
569 configuration.setAttribute(PHPLaunchConfigurationAttribute.REMOTE_DEBUG, fRemoteDebugCheckBox.getSelection());
570 configuration.setAttribute(PHPLaunchConfigurationAttribute.FILE_MAP, getMapFromPathMapTable());
571 configuration.setAttribute(PHPLaunchConfigurationAttribute.REMOTE_PATH, fRemoteSourcePath.getText());
572 configuration.setAttribute(PHPLaunchConfigurationAttribute.OPEN_DBGSESSION_IN_BROWSER, fOpenDBGSessionInBrowserCheckBox
576 protected Composite createPageRoot(Composite parent) {
577 Composite composite = new Composite(parent, SWT.NULL);
578 GridLayout layout = new GridLayout();
579 layout.numColumns = 2;
580 composite.setLayout(layout);
581 createVerticalSpacer(composite, 2);
582 setControl(composite);
587 private Map getMapFromPathMapTable() {
588 TableItem[] items = fRemoteDebugPathMapTable.getItems();
589 if (items.length == 0) {
592 Map map = new HashMap(items.length);
593 for (int i = 0; i < items.length; i++) {
594 TableItem item = items[i];
595 String key = item.getText(0);
596 String value = item.getText(1);
602 public String getName() {
603 return PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.name");
606 public boolean isValid(ILaunchConfiguration launchConfig) {
608 String selectedInterpreter = launchConfig.getAttribute(PHPLaunchConfigurationAttribute.SELECTED_INTERPRETER, "");
609 if (selectedInterpreter.length() == 0) {
610 setErrorMessage(PHPDebugUiMessages
611 .getString("LaunchConfigurationTab.PHPEnvironment.interpreter_not_selected_error_message"));
614 } catch (CoreException e) {
618 setErrorMessage(null);
622 protected void log(Throwable t) {
623 PHPDebugUiPlugin.log(t);
626 public Image getImage() {
627 return PHPUiImages.get(PHPUiImages.IMG_CTOOLS_PHP);