1 package net.sourceforge.phpdt.internal.debug.ui.launcher;
3 import java.util.ArrayList;
4 import java.util.HashMap;
5 import java.util.Iterator;
9 import net.sourceforge.phpdt.core.JavaCore;
10 import net.sourceforge.phpdt.internal.core.JavaProject;
11 import net.sourceforge.phpdt.internal.debug.ui.PHPDebugUiMessages;
12 import net.sourceforge.phpdt.internal.debug.ui.PHPDebugUiPlugin;
13 import net.sourceforge.phpdt.internal.debug.ui.preferences.EditInterpreterDialog;
14 import net.sourceforge.phpdt.internal.debug.ui.preferences.EditPathMapDialog;
15 import net.sourceforge.phpdt.internal.launching.PHPInterpreter;
16 import net.sourceforge.phpdt.internal.launching.PHPLaunchConfigurationAttribute;
17 import net.sourceforge.phpdt.internal.launching.PHPRuntime;
18 import net.sourceforge.phpdt.internal.ui.PHPUiImages;
19 import net.sourceforge.phpeclipse.LoadPathEntry;
20 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
22 import org.eclipse.core.resources.IProject;
23 import org.eclipse.core.runtime.CoreException;
24 import org.eclipse.debug.core.ILaunchConfiguration;
25 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
26 import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
27 import org.eclipse.jface.viewers.ColumnWeightData;
28 import org.eclipse.jface.viewers.ListViewer;
29 import org.eclipse.jface.viewers.TableLayout;
30 import org.eclipse.swt.SWT;
31 import org.eclipse.swt.events.ModifyEvent;
32 import org.eclipse.swt.events.ModifyListener;
33 import org.eclipse.swt.events.MouseAdapter;
34 import org.eclipse.swt.events.MouseEvent;
35 import org.eclipse.swt.events.SelectionAdapter;
36 import org.eclipse.swt.events.SelectionEvent;
37 import org.eclipse.swt.events.SelectionListener;
38 import org.eclipse.swt.graphics.Image;
39 import org.eclipse.swt.layout.GridData;
40 import org.eclipse.swt.layout.GridLayout;
41 import org.eclipse.swt.widgets.Button;
42 import org.eclipse.swt.widgets.Combo;
43 import org.eclipse.swt.widgets.Composite;
44 import org.eclipse.swt.widgets.Label;
45 import org.eclipse.swt.widgets.TabFolder;
46 import org.eclipse.swt.widgets.TabItem;
47 import org.eclipse.swt.widgets.Table;
48 import org.eclipse.swt.widgets.TableColumn;
49 import org.eclipse.swt.widgets.TableItem;
50 import org.eclipse.swt.widgets.Text;
51 import org.eclipse.ui.internal.dialogs.ListContentProvider;
53 public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab {
54 protected ListViewer loadPathListViewer;
55 protected java.util.List installedInterpretersWorkingCopy;
56 protected Combo interpreterCombo;
57 protected Button loadPathDefaultButton;
58 protected Button fRemoteDebugCheckBox;
59 protected Button fPathMapRemoveButton;
60 protected Button fPathMapAddButton;
61 protected Button fPathMapEditButton;
62 protected Text fRemoteSourcePath;
63 protected Table fRemoteDebugPathMapTable;
64 protected TabFolder tabFolder;
66 private class RemoteDebugTabListener extends SelectionAdapter implements ModifyListener {
69 * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
71 public void modifyText(ModifyEvent e) {
72 updateLaunchConfigurationDialog();
76 * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
78 public void widgetSelected(SelectionEvent e) {
79 Object source= e.getSource();
80 if (source == fRemoteDebugPathMapTable) {
81 setPathMapButtonsEnableState();
82 } else if (source == fPathMapAddButton) {
83 handlePathMapAddButtonSelected();
84 } else if (source == fPathMapEditButton) {
85 handlePathMapEditButtonSelected();
86 } else if (source == fPathMapRemoveButton) {
87 handlePathMapRemoveButtonSelected();
88 } else if (source == fRemoteDebugCheckBox) {
89 setRemoteTabEnableState();
91 updateLaunchConfigurationDialog();;
98 private static final String EMPTY_STRING = ""; //$NON-NLS-1$
99 private RemoteDebugTabListener fListener= new RemoteDebugTabListener();
101 private static final boolean DEFAULT_REMOTE_DEBUG= false;
102 static String [] columnTitles = { PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMapTableTitle.local"),
103 PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMapTableTitle.remote")
105 public PHPEnvironmentTab() {
109 public void createControl(Composite parent) {
110 Composite composite = createPageRoot(parent);
112 tabFolder = new TabFolder(composite, SWT.NONE);
113 GridData gridData = new GridData(GridData.FILL_BOTH);
114 tabFolder.setLayoutData(gridData);
116 addLoadPathTab(tabFolder);
117 addInterpreterTab(tabFolder);
118 addRemoteDebugTab(tabFolder);
121 protected void addRemoteDebugTab(TabFolder tabFolder)
125 TabItem remoteDebugTab = new TabItem(tabFolder, SWT.NONE, 0);
126 remoteDebugTab.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.label"));
128 Composite comp = new Composite(tabFolder, SWT.NONE);
129 comp.setLayout(new GridLayout());
130 remoteDebugTab.setControl(comp);
133 fRemoteDebugCheckBox = new Button(comp, SWT.CHECK);
134 fRemoteDebugCheckBox.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.RemoteCheckBox.label"));
135 fRemoteDebugCheckBox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
136 fRemoteDebugCheckBox.addSelectionListener(fListener);
138 label = new Label(comp, SWT.NONE);
139 label.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.RemoteSourcePath.label"));
140 fRemoteSourcePath = new Text(comp, SWT.BORDER | SWT.SINGLE);
141 gd = new GridData(GridData.FILL_HORIZONTAL);
142 fRemoteSourcePath.setLayoutData(gd);
143 fRemoteSourcePath.addModifyListener(fListener);
145 createVerticalSpacer(comp,1);
147 Composite pathMapComp = new Composite(comp, SWT.NONE);
148 gd = new GridData(GridData.FILL_BOTH);
149 pathMapComp.setLayoutData(gd);
150 GridLayout parametersLayout = new GridLayout();
151 parametersLayout.numColumns = 2;
152 parametersLayout.marginHeight = 0;
153 parametersLayout.marginWidth = 0;
154 pathMapComp.setLayout(parametersLayout);
157 Label pathMapLabel = new Label(pathMapComp, SWT.NONE);
158 pathMapLabel.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.label"));
160 gd.horizontalSpan = 2;
161 pathMapLabel.setLayoutData(gd);
164 fRemoteDebugPathMapTable = new Table(pathMapComp, SWT.BORDER | SWT.MULTI);
165 TableLayout tableLayout = new TableLayout();
166 fRemoteDebugPathMapTable.setLayout(tableLayout);
168 gd = new GridData(GridData.FILL_BOTH);
169 fRemoteDebugPathMapTable.setLayoutData(gd);
170 TableColumn column1 = new TableColumn(this.fRemoteDebugPathMapTable, SWT.NONE);
171 column1.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.Table.Title.local")); //$NON-NLS-1$
172 TableColumn column2 = new TableColumn(this.fRemoteDebugPathMapTable, SWT.NONE);
173 column2.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.Table.Title.remote")); //$NON-NLS-1$
174 tableLayout.addColumnData(new ColumnWeightData(100));
175 tableLayout.addColumnData(new ColumnWeightData(100));
176 fRemoteDebugPathMapTable.setHeaderVisible(true);
177 fRemoteDebugPathMapTable.setLinesVisible(true);
178 fRemoteDebugPathMapTable.addSelectionListener(fListener);
179 fRemoteDebugPathMapTable.addMouseListener(new MouseAdapter() {
180 public void mouseDoubleClick(MouseEvent e) {
181 setPathMapButtonsEnableState();
182 if (fPathMapEditButton.isEnabled()) {
183 handlePathMapEditButtonSelected();
187 // fRemoteDebugPathMapTable.setEnabled(false);
189 Composite envButtonComp = new Composite(pathMapComp, SWT.NONE);
190 GridLayout envButtonLayout = new GridLayout();
191 envButtonLayout.marginHeight = 0;
192 envButtonLayout.marginWidth = 0;
193 envButtonComp.setLayout(envButtonLayout);
194 gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL);
195 envButtonComp.setLayoutData(gd);
198 fPathMapAddButton = createPushButton(envButtonComp ,PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.Button.Add.label"), null); //$NON-NLS-1$
199 fPathMapAddButton.addSelectionListener(fListener);
200 // fPathMapAddButton.setEnabled(false);
202 fPathMapEditButton = createPushButton(envButtonComp,PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.Button.Edit.label"), null); //$NON-NLS-1$
203 fPathMapEditButton.addSelectionListener(fListener);
204 // fPathMapEditButton.setEnabled(false);
206 fPathMapRemoveButton = createPushButton(envButtonComp,PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.Button.Remove.label"), null); //$NON-NLS-1$
207 fPathMapRemoveButton.addSelectionListener(fListener);
208 // fPathMapRemoveButton.setEnabled(false);
213 void handlePathMapAddButtonSelected()
215 EditPathMapDialog dialog=
216 new EditPathMapDialog(
219 new String[] {EMPTY_STRING, EMPTY_STRING});
220 openNewPathMapDialog(dialog,null);
222 // if (dialog.open()==EditPathMapDialog.OK)
224 // TableItem item = new TableItem (fRemoteDebugPathMapTable, SWT.NONE);
225 // item.setText(0,dialog.getLocalPath());
226 // item.setText(1,dialog.getRemotePath());
227 // updateLaunchConfigurationDialog();
229 // updateLaunchConfigurationDialog();
230 setPathMapButtonsEnableState();
233 void handlePathMapRemoveButtonSelected()
235 int[] selectedIndices = this.fRemoteDebugPathMapTable.getSelectionIndices();
236 this.fRemoteDebugPathMapTable.remove(selectedIndices);
237 setPathMapButtonsEnableState();
238 updateLaunchConfigurationDialog();
241 void handlePathMapEditButtonSelected()
243 TableItem selectedItem = this.fRemoteDebugPathMapTable.getSelection()[0];
244 String local = selectedItem.getText(0);
245 String remote = selectedItem.getText(1);
246 EditPathMapDialog dialog=
247 new EditPathMapDialog(
250 new String[] {local, remote});
251 openNewPathMapDialog(dialog, selectedItem);
256 * Set the enabled state of whole tab.
258 private void setRemoteTabEnableState() {
259 boolean state=fRemoteDebugCheckBox.getSelection();
260 fRemoteSourcePath.setEnabled(state);
262 fRemoteDebugPathMapTable.setEnabled(state);
265 fPathMapEditButton.setEnabled(false);
266 fPathMapRemoveButton.setEnabled(false);
267 fPathMapAddButton.setEnabled(false);
269 setPathMapButtonsEnableState();
272 updateLaunchConfigurationDialog();
277 * Set the enabled state of the three environment variable-related buttons based on the
278 * selection in the PathMapTable widget.
280 private void setPathMapButtonsEnableState() {
281 // just do nothing for now
283 if(fRemoteDebugCheckBox.getSelection())
285 int selectCount = this.fRemoteDebugPathMapTable.getSelectionIndices().length;
286 if (selectCount < 1) {
287 fPathMapEditButton.setEnabled(false);
288 fPathMapRemoveButton.setEnabled(false);
290 fPathMapRemoveButton.setEnabled(true);
291 if (selectCount == 1) {
292 fPathMapEditButton.setEnabled(true);
294 fPathMapEditButton.setEnabled(false);
297 fPathMapAddButton.setEnabled(true);
302 * Show the specified dialog and update the pathMapTable table based on its results.
304 * @param updateItem the item to update, or <code>null</code> if
307 private void openNewPathMapDialog(EditPathMapDialog dialog, TableItem updateItem) {
308 if (dialog.open() != EditPathMapDialog.OK) {
311 String[] pathPair = dialog.getPathPair();
312 TableItem tableItem = updateItem;
313 if (tableItem == null) {
314 tableItem = getTableItemForName(pathPair[0]);
315 if (tableItem == null) {
316 tableItem = new TableItem(this.fRemoteDebugPathMapTable, SWT.NONE);
319 tableItem.setText(pathPair);
320 this.fRemoteDebugPathMapTable.setSelection(new TableItem[] {tableItem});
321 updateLaunchConfigurationDialog();
325 * Helper method that indicates whether the specified parameter name is already present
326 * in the parameters table.
328 private TableItem getTableItemForName(String candidateName) {
329 TableItem[] items = this.fRemoteDebugPathMapTable.getItems();
330 for (int i = 0; i < items.length; i++) {
331 String name = items[i].getText(0);
332 if (name.equals(candidateName)) {
341 protected void addLoadPathTab(TabFolder tabFolder) {
342 Composite loadPathComposite = new Composite(tabFolder, SWT.NONE);
343 loadPathComposite.setLayout(new GridLayout());
345 loadPathListViewer = new ListViewer(loadPathComposite, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
346 loadPathListViewer.setContentProvider(new ListContentProvider());
347 loadPathListViewer.setLabelProvider(new LoadPathEntryLabelProvider());
348 loadPathListViewer.getList().setLayoutData(new GridData(GridData.FILL_BOTH));
350 TabItem loadPathTab = new TabItem(tabFolder, SWT.NONE, 0);
351 loadPathTab.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.loadPathTab.label"));
352 loadPathTab.setControl(loadPathComposite);
353 loadPathTab.setData(loadPathListViewer);
355 loadPathDefaultButton = new Button(loadPathComposite, SWT.CHECK);
356 loadPathDefaultButton.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.loadPathDefaultButton.label"));
357 loadPathDefaultButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
358 loadPathDefaultButton.addSelectionListener(getLoadPathDefaultButtonSelectionListener());
360 loadPathDefaultButton.setEnabled(false); //for now, until the load path is customizable on the configuration
363 protected SelectionListener getLoadPathSelectionListener() {
364 return new SelectionAdapter() {
365 public void widgetSelected(SelectionEvent e) {
366 System.out.println("Loadpath list selection occurred: " + e.getSource());
373 protected SelectionListener getLoadPathDefaultButtonSelectionListener() {
374 return new SelectionAdapter() {
375 public void widgetSelected(SelectionEvent e) {
376 setUseLoadPathDefaults(((Button) e.getSource()).getSelection());
381 protected void addInterpreterTab(TabFolder tabFolder) {
382 Composite interpreterComposite = new Composite(tabFolder, SWT.NONE);
383 GridLayout layout = new GridLayout();
384 layout.numColumns = 2;
385 layout.marginHeight = 0;
386 layout.marginWidth = 0;
387 interpreterComposite.setLayout(layout);
388 interpreterComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
390 createVerticalSpacer(interpreterComposite, 2);
392 interpreterCombo = new Combo(interpreterComposite, SWT.READ_ONLY);
393 interpreterCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
394 initializeInterpreterCombo(interpreterCombo);
395 interpreterCombo.addModifyListener(getInterpreterComboModifyListener());
397 Button interpreterAddButton = new Button(interpreterComposite, SWT.PUSH);
398 interpreterAddButton.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.interpreterAddButton.label"));
399 interpreterAddButton.addSelectionListener(new SelectionAdapter() {
400 public void widgetSelected(SelectionEvent evt) {
401 PHPInterpreter newInterpreter = new PHPInterpreter(null, null);
402 EditInterpreterDialog editor = new EditInterpreterDialog(getShell(), PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.editInterpreterDialog.title"));
404 editor.setInterpreterToEdit(newInterpreter);
405 if (EditInterpreterDialog.OK == editor.open()) {
406 PHPRuntime.getDefault().addInstalledInterpreter(newInterpreter);
407 interpreterCombo.add(newInterpreter.getName());
408 interpreterCombo.select(interpreterCombo.indexOf(newInterpreter.getName()));
413 TabItem interpreterTab = new TabItem(tabFolder, SWT.NONE);
414 interpreterTab.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.interpreterTab.label"));
415 interpreterTab.setControl(interpreterComposite);
418 protected ModifyListener getInterpreterComboModifyListener() {
419 return new ModifyListener() {
420 public void modifyText(ModifyEvent evt) {
421 updateLaunchConfigurationDialog();
426 protected void createVerticalSpacer(Composite comp, int colSpan) {
427 Label label = new Label(comp, SWT.NONE);
428 GridData gd = new GridData();
429 gd.horizontalSpan = colSpan;
430 label.setLayoutData(gd);
433 public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
436 public void initializeFrom(ILaunchConfiguration configuration) {
437 initializeLoadPath(configuration);
438 initializeInterpreterSelection(configuration);
439 initializeRemoteDebug(configuration);
442 protected void initializeRemoteDebug(ILaunchConfiguration configuration)
448 fRemoteDebugCheckBox.setSelection(
449 configuration.getAttribute(PHPLaunchConfigurationAttribute.REMOTE_DEBUG,DEFAULT_REMOTE_DEBUG));
450 } catch(CoreException ce) {
451 fRemoteDebugCheckBox.setSelection(DEFAULT_REMOTE_DEBUG);
453 setRemoteTabEnableState();
455 fRemoteSourcePath.setText(
456 configuration.getAttribute(PHPLaunchConfigurationAttribute.REMOTE_PATH,""));
457 } catch(CoreException ce) {
458 fRemoteSourcePath.setText("");
461 updatePathMapFromConfig(configuration);
465 private void updatePathMapFromConfig(ILaunchConfiguration config) {
468 if (config != null) {
469 envVars = config.getAttribute(PHPLaunchConfigurationAttribute.FILE_MAP, (Map)null);
471 updatePathMapTable(envVars, this.fRemoteDebugPathMapTable);
472 setPathMapButtonsEnableState();
473 } catch (CoreException ce) {
478 private void updatePathMapTable(Map map, Table tableWidget) {
479 tableWidget.removeAll();
483 Iterator iterator = map.keySet().iterator();
484 while (iterator.hasNext()) {
485 String key = (String) iterator.next();
486 String value = (String) map.get(key);
487 TableItem tableItem = new TableItem(tableWidget, SWT.NONE);
488 tableItem.setText(new String[] {key, value});
492 protected void initializeLoadPath(ILaunchConfiguration configuration) {
493 boolean useDefaultLoadPath = true;
495 useDefaultLoadPath = configuration.getAttribute(PHPLaunchConfigurationAttribute.USE_DEFAULT_LOAD_PATH, true);
496 setUseLoadPathDefaults(useDefaultLoadPath);
497 if (useDefaultLoadPath) {
498 String projectName = configuration.getAttribute(PHPLaunchConfigurationAttribute.PROJECT_NAME, "");
499 if (projectName != "") {
500 IProject aProject = PHPeclipsePlugin.getWorkspace().getRoot().getProject(projectName);
501 if ((aProject != null) && JavaCore.isPHPProject(aProject)) {
502 JavaProject thePHPProject = new JavaProject();
503 thePHPProject.setProject(aProject);
504 List loadPathEntries = thePHPProject.getLoadPathEntries();
505 loadPathListViewer.setInput(loadPathEntries);
509 } catch (CoreException e) {
514 protected void setUseLoadPathDefaults(boolean useDefaults) {
515 loadPathListViewer.getList().setEnabled(!useDefaults);
516 loadPathDefaultButton.setSelection(useDefaults);
519 protected void initializeInterpreterSelection(ILaunchConfiguration configuration) {
520 String interpreterName = null;
522 interpreterName = configuration.getAttribute(PHPLaunchConfigurationAttribute.SELECTED_INTERPRETER, "");
523 } catch (CoreException e) {
526 if (interpreterName != null && !interpreterName.equals(""))
527 interpreterCombo.select(interpreterCombo.indexOf(interpreterName));
530 protected void initializeInterpreterCombo(Combo interpreterCombo) {
531 installedInterpretersWorkingCopy = new ArrayList();
532 installedInterpretersWorkingCopy.addAll(PHPRuntime.getDefault().getInstalledInterpreters());
534 String[] interpreterNames = new String[installedInterpretersWorkingCopy.size()];
535 for (int interpreterIndex = 0; interpreterIndex < installedInterpretersWorkingCopy.size(); interpreterIndex++) {
536 PHPInterpreter interpreter = (PHPInterpreter) installedInterpretersWorkingCopy.get(interpreterIndex);
537 interpreterNames[interpreterIndex] = interpreter.getName();
539 interpreterCombo.setItems(interpreterNames);
541 PHPInterpreter selectedInterpreter = PHPRuntime.getDefault().getSelectedInterpreter();
542 if (selectedInterpreter != null)
543 interpreterCombo.select(interpreterCombo.indexOf(selectedInterpreter.getName()));
546 public void performApply(ILaunchConfigurationWorkingCopy configuration) {
547 int selectionIndex = interpreterCombo.getSelectionIndex();
548 if (selectionIndex >= 0)
549 configuration.setAttribute(PHPLaunchConfigurationAttribute.SELECTED_INTERPRETER, interpreterCombo.getItem(selectionIndex));
551 configuration.setAttribute(PHPLaunchConfigurationAttribute.USE_DEFAULT_LOAD_PATH, loadPathDefaultButton.getSelection());
553 if (!loadPathDefaultButton.getSelection()) {
554 List loadPathEntries = (List) loadPathListViewer.getInput();
555 List loadPathStrings = new ArrayList();
556 for (Iterator iterator = loadPathEntries.iterator(); iterator.hasNext();) {
557 LoadPathEntry entry = (LoadPathEntry) iterator.next();
558 loadPathStrings.add(entry.getPath().toString());
560 configuration.setAttribute(PHPLaunchConfigurationAttribute.CUSTOM_LOAD_PATH, loadPathStrings);
563 configuration.setAttribute(PHPLaunchConfigurationAttribute.REMOTE_DEBUG, fRemoteDebugCheckBox.getSelection());
564 configuration.setAttribute(PHPLaunchConfigurationAttribute.FILE_MAP, getMapFromPathMapTable());
565 configuration.setAttribute(PHPLaunchConfigurationAttribute.REMOTE_PATH, fRemoteSourcePath.getText());
568 protected Composite createPageRoot(Composite parent) {
569 Composite composite = new Composite(parent, SWT.NULL);
570 GridLayout layout = new GridLayout();
571 layout.numColumns = 2;
572 composite.setLayout(layout);
573 createVerticalSpacer(composite, 2);
574 setControl(composite);
579 private Map getMapFromPathMapTable() {
580 TableItem[] items = fRemoteDebugPathMapTable.getItems();
581 if (items.length == 0) {
584 Map map = new HashMap(items.length);
585 for (int i = 0; i < items.length; i++) {
586 TableItem item = items[i];
587 String key = item.getText(0);
588 String value = item.getText(1);
594 public String getName() {
595 return PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.name");
598 public boolean isValid(ILaunchConfiguration launchConfig) {
600 String selectedInterpreter = launchConfig.getAttribute(PHPLaunchConfigurationAttribute.SELECTED_INTERPRETER, "");
601 if (selectedInterpreter.length() == 0) {
602 setErrorMessage(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.interpreter_not_selected_error_message"));
605 } catch (CoreException e) {
609 setErrorMessage(null);
613 protected void log(Throwable t) {
614 PHPDebugUiPlugin.log(t);
617 public Image getImage() {
618 return PHPUiImages.get(PHPUiImages.IMG_CTOOLS_PHP);