1 package net.sourceforge.phpdt.internal.debug.ui.launcher;
3 import java.util.ArrayList;
4 import java.util.Iterator;
6 import java.util.HashMap;
9 import net.sourceforge.phpdt.internal.debug.ui.PHPDebugUiMessages;
10 import net.sourceforge.phpdt.internal.debug.ui.PHPDebugUiPlugin;
11 import net.sourceforge.phpdt.internal.debug.ui.preferences.EditInterpreterDialog;
12 import net.sourceforge.phpdt.internal.debug.ui.preferences.EditPathMapDialog;
13 import net.sourceforge.phpdt.internal.launching.PHPInterpreter;
14 import net.sourceforge.phpdt.internal.launching.PHPLaunchConfigurationAttribute;
15 import net.sourceforge.phpdt.internal.launching.PHPRuntime;
16 import net.sourceforge.phpdt.internal.ui.PHPUiImages;
17 import net.sourceforge.phpeclipse.LoadPathEntry;
18 import net.sourceforge.phpeclipse.PHPCore;
19 import net.sourceforge.phpeclipse.resourcesview.PHPProject;
21 import org.eclipse.core.runtime.CoreException;
22 import org.eclipse.debug.core.ILaunchConfiguration;
23 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
24 import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
25 import org.eclipse.jface.viewers.ListViewer;
26 import org.eclipse.jface.viewers.TableLayout;
27 import org.eclipse.jface.viewers.ColumnWeightData;
28 import org.eclipse.swt.SWT;
29 import org.eclipse.swt.events.ModifyEvent;
30 import org.eclipse.swt.events.ModifyListener;
31 import org.eclipse.swt.events.SelectionAdapter;
32 import org.eclipse.swt.events.SelectionEvent;
33 import org.eclipse.swt.events.SelectionListener;
34 import org.eclipse.swt.events.MouseAdapter;
35 import org.eclipse.swt.events.MouseEvent;
36 import org.eclipse.swt.graphics.Image;
37 import org.eclipse.swt.layout.GridData;
38 import org.eclipse.swt.layout.GridLayout;
39 import org.eclipse.swt.widgets.Button;
40 import org.eclipse.swt.widgets.Combo;
41 import org.eclipse.swt.widgets.Composite;
42 import org.eclipse.swt.widgets.Label;
43 import org.eclipse.swt.widgets.TabFolder;
44 import org.eclipse.swt.widgets.TabItem;
45 import org.eclipse.swt.widgets.Table;
46 import org.eclipse.swt.widgets.TableItem;
47 import org.eclipse.swt.widgets.Text;
48 import org.eclipse.swt.widgets.TableColumn;
49 import org.eclipse.ui.internal.dialogs.ListContentProvider;
51 public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab {
52 protected ListViewer loadPathListViewer;
53 protected java.util.List installedInterpretersWorkingCopy;
54 protected Combo interpreterCombo;
55 protected Button loadPathDefaultButton;
56 protected Button fRemoteDebugCheckBox;
57 protected Button fPathMapRemoveButton;
58 protected Button fPathMapAddButton;
59 protected Button fPathMapEditButton;
60 protected Text fRemoteSourcePath;
61 protected Table fRemoteDebugPathMapTable;
62 protected TabFolder tabFolder;
64 private class RemoteDebugTabListener extends SelectionAdapter implements ModifyListener {
67 * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
69 public void modifyText(ModifyEvent e) {
70 updateLaunchConfigurationDialog();
74 * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
76 public void widgetSelected(SelectionEvent e) {
77 Object source= e.getSource();
78 if (source == fRemoteDebugPathMapTable) {
79 setPathMapButtonsEnableState();
80 } else if (source == fPathMapAddButton) {
81 handlePathMapAddButtonSelected();
82 } else if (source == fPathMapEditButton) {
83 handlePathMapEditButtonSelected();
84 } else if (source == fPathMapRemoveButton) {
85 handlePathMapRemoveButtonSelected();
86 } else if (source == fRemoteDebugCheckBox) {
87 setRemoteTabEnableState();
89 updateLaunchConfigurationDialog();;
96 private static final String EMPTY_STRING = ""; //$NON-NLS-1$
97 private RemoteDebugTabListener fListener= new RemoteDebugTabListener();
99 private static final boolean DEFAULT_REMOTE_DEBUG= false;
100 static String [] columnTitles = { PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMapTableTitle.local"),
101 PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMapTableTitle.remote")
103 public PHPEnvironmentTab() {
107 public void createControl(Composite parent) {
108 Composite composite = createPageRoot(parent);
110 tabFolder = new TabFolder(composite, SWT.NONE);
111 GridData gridData = new GridData(GridData.FILL_BOTH);
112 tabFolder.setLayoutData(gridData);
114 addLoadPathTab(tabFolder);
115 addInterpreterTab(tabFolder);
116 addRemoteDebugTab(tabFolder);
119 protected void addRemoteDebugTab(TabFolder tabFolder)
123 TabItem remoteDebugTab = new TabItem(tabFolder, SWT.NONE, 0);
124 remoteDebugTab.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.label"));
126 Composite comp = new Composite(tabFolder, SWT.NONE);
127 comp.setLayout(new GridLayout());
128 remoteDebugTab.setControl(comp);
131 fRemoteDebugCheckBox = new Button(comp, SWT.CHECK);
132 fRemoteDebugCheckBox.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.RemoteCheckBox.label"));
133 fRemoteDebugCheckBox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
134 fRemoteDebugCheckBox.addSelectionListener(fListener);
136 label = new Label(comp, SWT.NONE);
137 label.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.RemoteSourcePath.label"));
138 fRemoteSourcePath = new Text(comp, SWT.BORDER | SWT.SINGLE);
139 gd = new GridData(GridData.FILL_HORIZONTAL);
140 fRemoteSourcePath.setLayoutData(gd);
141 fRemoteSourcePath.addModifyListener(fListener);
143 createVerticalSpacer(comp,1);
145 Composite pathMapComp = new Composite(comp, SWT.NONE);
146 gd = new GridData(GridData.FILL_BOTH);
147 pathMapComp.setLayoutData(gd);
148 GridLayout parametersLayout = new GridLayout();
149 parametersLayout.numColumns = 2;
150 parametersLayout.marginHeight = 0;
151 parametersLayout.marginWidth = 0;
152 pathMapComp.setLayout(parametersLayout);
155 Label pathMapLabel = new Label(pathMapComp, SWT.NONE);
156 pathMapLabel.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.label"));
158 gd.horizontalSpan = 2;
159 pathMapLabel.setLayoutData(gd);
162 fRemoteDebugPathMapTable = new Table(pathMapComp, SWT.BORDER | SWT.MULTI);
163 TableLayout tableLayout = new TableLayout();
164 fRemoteDebugPathMapTable.setLayout(tableLayout);
166 gd = new GridData(GridData.FILL_BOTH);
167 fRemoteDebugPathMapTable.setLayoutData(gd);
168 TableColumn column1 = new TableColumn(this.fRemoteDebugPathMapTable, SWT.NONE);
169 column1.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.Table.Title.local")); //$NON-NLS-1$
170 TableColumn column2 = new TableColumn(this.fRemoteDebugPathMapTable, SWT.NONE);
171 column2.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.Table.Title.remote")); //$NON-NLS-1$
172 tableLayout.addColumnData(new ColumnWeightData(100));
173 tableLayout.addColumnData(new ColumnWeightData(100));
174 fRemoteDebugPathMapTable.setHeaderVisible(true);
175 fRemoteDebugPathMapTable.setLinesVisible(true);
176 fRemoteDebugPathMapTable.addSelectionListener(fListener);
177 fRemoteDebugPathMapTable.addMouseListener(new MouseAdapter() {
178 public void mouseDoubleClick(MouseEvent e) {
179 setPathMapButtonsEnableState();
180 if (fPathMapEditButton.isEnabled()) {
181 handlePathMapEditButtonSelected();
185 // fRemoteDebugPathMapTable.setEnabled(false);
187 Composite envButtonComp = new Composite(pathMapComp, SWT.NONE);
188 GridLayout envButtonLayout = new GridLayout();
189 envButtonLayout.marginHeight = 0;
190 envButtonLayout.marginWidth = 0;
191 envButtonComp.setLayout(envButtonLayout);
192 gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL);
193 envButtonComp.setLayoutData(gd);
196 fPathMapAddButton = createPushButton(envButtonComp ,PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.Button.Add.label"), null); //$NON-NLS-1$
197 fPathMapAddButton.addSelectionListener(fListener);
198 // fPathMapAddButton.setEnabled(false);
200 fPathMapEditButton = createPushButton(envButtonComp,PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.Button.Edit.label"), null); //$NON-NLS-1$
201 fPathMapEditButton.addSelectionListener(fListener);
202 // fPathMapEditButton.setEnabled(false);
204 fPathMapRemoveButton = createPushButton(envButtonComp,PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.Button.Remove.label"), null); //$NON-NLS-1$
205 fPathMapRemoveButton.addSelectionListener(fListener);
206 // fPathMapRemoveButton.setEnabled(false);
211 void handlePathMapAddButtonSelected()
213 EditPathMapDialog dialog=
214 new EditPathMapDialog(
217 new String[] {EMPTY_STRING, EMPTY_STRING});
218 openNewPathMapDialog(dialog,null);
220 // if (dialog.open()==EditPathMapDialog.OK)
222 // TableItem item = new TableItem (fRemoteDebugPathMapTable, SWT.NONE);
223 // item.setText(0,dialog.getLocalPath());
224 // item.setText(1,dialog.getRemotePath());
225 // updateLaunchConfigurationDialog();
227 // updateLaunchConfigurationDialog();
228 setPathMapButtonsEnableState();
231 void handlePathMapRemoveButtonSelected()
233 int[] selectedIndices = this.fRemoteDebugPathMapTable.getSelectionIndices();
234 this.fRemoteDebugPathMapTable.remove(selectedIndices);
235 setPathMapButtonsEnableState();
236 updateLaunchConfigurationDialog();
239 void handlePathMapEditButtonSelected()
241 TableItem selectedItem = this.fRemoteDebugPathMapTable.getSelection()[0];
242 String local = selectedItem.getText(0);
243 String remote = selectedItem.getText(1);
244 EditPathMapDialog dialog=
245 new EditPathMapDialog(
248 new String[] {local, remote});
249 openNewPathMapDialog(dialog, selectedItem);
254 * Set the enabled state of whole tab.
256 private void setRemoteTabEnableState() {
257 boolean state=fRemoteDebugCheckBox.getSelection();
258 fRemoteSourcePath.setEnabled(state);
260 fRemoteDebugPathMapTable.setEnabled(state);
263 fPathMapEditButton.setEnabled(false);
264 fPathMapRemoveButton.setEnabled(false);
265 fPathMapAddButton.setEnabled(false);
267 setPathMapButtonsEnableState();
270 updateLaunchConfigurationDialog();
275 * Set the enabled state of the three environment variable-related buttons based on the
276 * selection in the PathMapTable widget.
278 private void setPathMapButtonsEnableState() {
279 // just do nothing for now
281 if(fRemoteDebugCheckBox.getSelection())
283 int selectCount = this.fRemoteDebugPathMapTable.getSelectionIndices().length;
284 if (selectCount < 1) {
285 fPathMapEditButton.setEnabled(false);
286 fPathMapRemoveButton.setEnabled(false);
288 fPathMapRemoveButton.setEnabled(true);
289 if (selectCount == 1) {
290 fPathMapEditButton.setEnabled(true);
292 fPathMapEditButton.setEnabled(false);
295 fPathMapAddButton.setEnabled(true);
300 * Show the specified dialog and update the pathMapTable table based on its results.
302 * @param updateItem the item to update, or <code>null</code> if
305 private void openNewPathMapDialog(EditPathMapDialog dialog, TableItem updateItem) {
306 if (dialog.open() != EditPathMapDialog.OK) {
309 String[] pathPair = dialog.getPathPair();
310 TableItem tableItem = updateItem;
311 if (tableItem == null) {
312 tableItem = getTableItemForName(pathPair[0]);
313 if (tableItem == null) {
314 tableItem = new TableItem(this.fRemoteDebugPathMapTable, SWT.NONE);
317 tableItem.setText(pathPair);
318 this.fRemoteDebugPathMapTable.setSelection(new TableItem[] {tableItem});
319 updateLaunchConfigurationDialog();
323 * Helper method that indicates whether the specified parameter name is already present
324 * in the parameters table.
326 private TableItem getTableItemForName(String candidateName) {
327 TableItem[] items = this.fRemoteDebugPathMapTable.getItems();
328 for (int i = 0; i < items.length; i++) {
329 String name = items[i].getText(0);
330 if (name.equals(candidateName)) {
339 protected void addLoadPathTab(TabFolder tabFolder) {
340 Composite loadPathComposite = new Composite(tabFolder, SWT.NONE);
341 loadPathComposite.setLayout(new GridLayout());
343 loadPathListViewer = new ListViewer(loadPathComposite, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
344 loadPathListViewer.setContentProvider(new ListContentProvider());
345 loadPathListViewer.setLabelProvider(new LoadPathEntryLabelProvider());
346 loadPathListViewer.getList().setLayoutData(new GridData(GridData.FILL_BOTH));
348 TabItem loadPathTab = new TabItem(tabFolder, SWT.NONE, 0);
349 loadPathTab.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.loadPathTab.label"));
350 loadPathTab.setControl(loadPathComposite);
351 loadPathTab.setData(loadPathListViewer);
353 loadPathDefaultButton = new Button(loadPathComposite, SWT.CHECK);
354 loadPathDefaultButton.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.loadPathDefaultButton.label"));
355 loadPathDefaultButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
356 loadPathDefaultButton.addSelectionListener(getLoadPathDefaultButtonSelectionListener());
358 loadPathDefaultButton.setEnabled(false); //for now, until the load path is customizable on the configuration
361 protected SelectionListener getLoadPathSelectionListener() {
362 return new SelectionAdapter() {
363 public void widgetSelected(SelectionEvent e) {
364 System.out.println("Loadpath list selection occurred: " + e.getSource());
371 protected SelectionListener getLoadPathDefaultButtonSelectionListener() {
372 return new SelectionAdapter() {
373 public void widgetSelected(SelectionEvent e) {
374 setUseLoadPathDefaults(((Button) e.getSource()).getSelection());
379 protected void addInterpreterTab(TabFolder tabFolder) {
380 Composite interpreterComposite = new Composite(tabFolder, SWT.NONE);
381 GridLayout layout = new GridLayout();
382 layout.numColumns = 2;
383 layout.marginHeight = 0;
384 layout.marginWidth = 0;
385 interpreterComposite.setLayout(layout);
386 interpreterComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
388 createVerticalSpacer(interpreterComposite, 2);
390 interpreterCombo = new Combo(interpreterComposite, SWT.READ_ONLY);
391 interpreterCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
392 initializeInterpreterCombo(interpreterCombo);
393 interpreterCombo.addModifyListener(getInterpreterComboModifyListener());
395 Button interpreterAddButton = new Button(interpreterComposite, SWT.PUSH);
396 interpreterAddButton.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.interpreterAddButton.label"));
397 interpreterAddButton.addSelectionListener(new SelectionAdapter() {
398 public void widgetSelected(SelectionEvent evt) {
399 PHPInterpreter newInterpreter = new PHPInterpreter(null, null);
400 EditInterpreterDialog editor = new EditInterpreterDialog(getShell(), PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.editInterpreterDialog.title"));
402 editor.setInterpreterToEdit(newInterpreter);
403 if (EditInterpreterDialog.OK == editor.open()) {
404 PHPRuntime.getDefault().addInstalledInterpreter(newInterpreter);
405 interpreterCombo.add(newInterpreter.getName());
406 interpreterCombo.select(interpreterCombo.indexOf(newInterpreter.getName()));
411 TabItem interpreterTab = new TabItem(tabFolder, SWT.NONE);
412 interpreterTab.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.interpreterTab.label"));
413 interpreterTab.setControl(interpreterComposite);
416 protected ModifyListener getInterpreterComboModifyListener() {
417 return new ModifyListener() {
418 public void modifyText(ModifyEvent evt) {
419 updateLaunchConfigurationDialog();
424 protected void createVerticalSpacer(Composite comp, int colSpan) {
425 Label label = new Label(comp, SWT.NONE);
426 GridData gd = new GridData();
427 gd.horizontalSpan = colSpan;
428 label.setLayoutData(gd);
431 public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
434 public void initializeFrom(ILaunchConfiguration configuration) {
435 initializeLoadPath(configuration);
436 initializeInterpreterSelection(configuration);
437 initializeRemoteDebug(configuration);
440 protected void initializeRemoteDebug(ILaunchConfiguration configuration)
446 fRemoteDebugCheckBox.setSelection(
447 configuration.getAttribute(PHPLaunchConfigurationAttribute.REMOTE_DEBUG,DEFAULT_REMOTE_DEBUG));
448 } catch(CoreException ce) {
449 fRemoteDebugCheckBox.setSelection(DEFAULT_REMOTE_DEBUG);
451 setRemoteTabEnableState();
453 fRemoteSourcePath.setText(
454 configuration.getAttribute(PHPLaunchConfigurationAttribute.REMOTE_PATH,""));
455 } catch(CoreException ce) {
456 fRemoteSourcePath.setText("");
459 updatePathMapFromConfig(configuration);
463 private void updatePathMapFromConfig(ILaunchConfiguration config) {
466 if (config != null) {
467 envVars = config.getAttribute(PHPLaunchConfigurationAttribute.FILE_MAP, (Map)null);
469 updatePathMapTable(envVars, this.fRemoteDebugPathMapTable);
470 setPathMapButtonsEnableState();
471 } catch (CoreException ce) {
476 private void updatePathMapTable(Map map, Table tableWidget) {
477 tableWidget.removeAll();
481 Iterator iterator = map.keySet().iterator();
482 while (iterator.hasNext()) {
483 String key = (String) iterator.next();
484 String value = (String) map.get(key);
485 TableItem tableItem = new TableItem(tableWidget, SWT.NONE);
486 tableItem.setText(new String[] {key, value});
490 protected void initializeLoadPath(ILaunchConfiguration configuration) {
491 boolean useDefaultLoadPath = true;
493 useDefaultLoadPath = configuration.getAttribute(PHPLaunchConfigurationAttribute.USE_DEFAULT_LOAD_PATH, true);
494 setUseLoadPathDefaults(useDefaultLoadPath);
495 if (useDefaultLoadPath) {
496 String projectName = configuration.getAttribute(PHPLaunchConfigurationAttribute.PROJECT_NAME, "");
497 if (projectName != "") {
498 PHPProject project = PHPCore.getPHPProject(projectName);
499 if (project != null) {
500 List loadPathEntries = project.getLoadPathEntries();
501 loadPathListViewer.setInput(loadPathEntries);
505 } catch (CoreException e) {
510 protected void setUseLoadPathDefaults(boolean useDefaults) {
511 loadPathListViewer.getList().setEnabled(!useDefaults);
512 loadPathDefaultButton.setSelection(useDefaults);
515 protected void initializeInterpreterSelection(ILaunchConfiguration configuration) {
516 String interpreterName = null;
518 interpreterName = configuration.getAttribute(PHPLaunchConfigurationAttribute.SELECTED_INTERPRETER, "");
519 } catch (CoreException e) {
522 if (interpreterName != null && !interpreterName.equals(""))
523 interpreterCombo.select(interpreterCombo.indexOf(interpreterName));
526 protected void initializeInterpreterCombo(Combo interpreterCombo) {
527 installedInterpretersWorkingCopy = new ArrayList();
528 installedInterpretersWorkingCopy.addAll(PHPRuntime.getDefault().getInstalledInterpreters());
530 String[] interpreterNames = new String[installedInterpretersWorkingCopy.size()];
531 for (int interpreterIndex = 0; interpreterIndex < installedInterpretersWorkingCopy.size(); interpreterIndex++) {
532 PHPInterpreter interpreter = (PHPInterpreter) installedInterpretersWorkingCopy.get(interpreterIndex);
533 interpreterNames[interpreterIndex] = interpreter.getName();
535 interpreterCombo.setItems(interpreterNames);
537 PHPInterpreter selectedInterpreter = PHPRuntime.getDefault().getSelectedInterpreter();
538 if (selectedInterpreter != null)
539 interpreterCombo.select(interpreterCombo.indexOf(selectedInterpreter.getName()));
542 public void performApply(ILaunchConfigurationWorkingCopy configuration) {
543 int selectionIndex = interpreterCombo.getSelectionIndex();
544 if (selectionIndex >= 0)
545 configuration.setAttribute(PHPLaunchConfigurationAttribute.SELECTED_INTERPRETER, interpreterCombo.getItem(selectionIndex));
547 configuration.setAttribute(PHPLaunchConfigurationAttribute.USE_DEFAULT_LOAD_PATH, loadPathDefaultButton.getSelection());
549 if (!loadPathDefaultButton.getSelection()) {
550 List loadPathEntries = (List) loadPathListViewer.getInput();
551 List loadPathStrings = new ArrayList();
552 for (Iterator iterator = loadPathEntries.iterator(); iterator.hasNext();) {
553 LoadPathEntry entry = (LoadPathEntry) iterator.next();
554 loadPathStrings.add(entry.getPath().toString());
556 configuration.setAttribute(PHPLaunchConfigurationAttribute.CUSTOM_LOAD_PATH, loadPathStrings);
559 configuration.setAttribute(PHPLaunchConfigurationAttribute.REMOTE_DEBUG, fRemoteDebugCheckBox.getSelection());
560 configuration.setAttribute(PHPLaunchConfigurationAttribute.FILE_MAP, getMapFromPathMapTable());
561 configuration.setAttribute(PHPLaunchConfigurationAttribute.REMOTE_PATH, fRemoteSourcePath.getText());
564 protected Composite createPageRoot(Composite parent) {
565 Composite composite = new Composite(parent, SWT.NULL);
566 GridLayout layout = new GridLayout();
567 layout.numColumns = 2;
568 composite.setLayout(layout);
569 createVerticalSpacer(composite, 2);
570 setControl(composite);
575 private Map getMapFromPathMapTable() {
576 TableItem[] items = fRemoteDebugPathMapTable.getItems();
577 if (items.length == 0) {
580 Map map = new HashMap(items.length);
581 for (int i = 0; i < items.length; i++) {
582 TableItem item = items[i];
583 String key = item.getText(0);
584 String value = item.getText(1);
590 public String getName() {
591 return PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.name");
594 public boolean isValid(ILaunchConfiguration launchConfig) {
596 String selectedInterpreter = launchConfig.getAttribute(PHPLaunchConfigurationAttribute.SELECTED_INTERPRETER, "");
597 if (selectedInterpreter.length() == 0) {
598 setErrorMessage(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.interpreter_not_selected_error_message"));
601 } catch (CoreException e) {
605 setErrorMessage(null);
609 protected void log(Throwable t) {
610 PHPDebugUiPlugin.log(t);
613 public Image getImage() {
614 return PHPUiImages.get(PHPUiImages.IMG_CTOOLS_PHP);