X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPEnvironmentTab.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPEnvironmentTab.java index e404e63..a40d0c0 100644 --- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPEnvironmentTab.java +++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPEnvironmentTab.java @@ -1,5 +1,6 @@ package net.sourceforge.phpdt.internal.debug.ui.launcher; +import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; @@ -7,8 +8,8 @@ import java.util.Map; import net.sourceforge.phpdt.internal.debug.ui.PHPDebugUiMessages; import net.sourceforge.phpdt.internal.debug.ui.PHPDebugUiPlugin; -import net.sourceforge.phpdt.internal.debug.ui.preferences.EditInterpreterDialog; import net.sourceforge.phpdt.internal.debug.ui.preferences.EditPathMapDialog; +import net.sourceforge.phpdt.internal.debug.ui.preferences.PHPInterpreterPreferencePage; import net.sourceforge.phpdt.internal.launching.PHPInterpreter; import net.sourceforge.phpdt.internal.launching.PHPLaunchConfigurationAttribute; import net.sourceforge.phpdt.internal.launching.PHPRuntime; @@ -52,6 +53,7 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab { // protected Button loadPathDefaultButton; protected Button fRemoteDebugCheckBox; + protected Button fRemoteDebugTranslate; protected Button fOpenDBGSessionInBrowserCheckBox; @@ -95,6 +97,8 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab { handlePathMapRemoveButtonSelected(); } else if (source == fRemoteDebugCheckBox) { setRemoteTabEnableState(); + } else if (source == fRemoteDebugTranslate) { + setRemoteTabEnableState(); } else { updateLaunchConfigurationDialog(); ; @@ -110,6 +114,8 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab { private static final boolean DEFAULT_REMOTE_DEBUG = false; + private static final boolean DEFAULT_REMOTE_DEBUG_TRANSLATE = false; + private static final boolean DEFAULT_OPEN_DBGSESSION_IN_BROWSER = true; static String[] columnTitles = { @@ -149,6 +155,12 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab { fRemoteDebugCheckBox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); fRemoteDebugCheckBox.addSelectionListener(fListener); + fRemoteDebugTranslate = new Button(comp, SWT.CHECK); + fRemoteDebugTranslate.setText(PHPDebugUiMessages + .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.RemoteTranslate.label")); + fRemoteDebugTranslate.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); + fRemoteDebugTranslate.addSelectionListener(fListener); + fOpenDBGSessionInBrowserCheckBox = new Button(comp, SWT.CHECK); fOpenDBGSessionInBrowserCheckBox.setText(PHPDebugUiMessages .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.OpenDBGSessionInBrowserCheckBox.label")); @@ -266,7 +278,8 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab { private void setRemoteTabEnableState() { boolean state = fRemoteDebugCheckBox.getSelection(); fRemoteSourcePath.setEnabled(state); - + fRemoteDebugTranslate.setEnabled(state); + fRemoteDebugPathMapTable.setEnabled(state); if (!state) { fPathMapEditButton.setEnabled(false); @@ -288,6 +301,7 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab { // if (fRemoteDebugCheckBox.getSelection()) { fOpenDBGSessionInBrowserCheckBox.setEnabled(true); + fRemoteDebugTranslate.setEnabled(true); int selectCount = this.fRemoteDebugPathMapTable.getSelectionIndices().length; if (selectCount < 1) { fPathMapEditButton.setEnabled(false); @@ -399,15 +413,13 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab { interpreterAddButton.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.interpreterAddButton.label")); interpreterAddButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent evt) { - PHPInterpreter newInterpreter = new PHPInterpreter(null, null); - EditInterpreterDialog editor = new EditInterpreterDialog(getShell(), PHPDebugUiMessages - .getString("LaunchConfigurationTab.PHPEnvironment.editInterpreterDialog.title")); - editor.create(); - editor.setInterpreterToEdit(newInterpreter); - if (EditInterpreterDialog.OK == editor.open()) { + PHPInterpreter newInterpreter = new PHPInterpreter(null); + File phpRuntime = PHPInterpreterPreferencePage.getFile(getShell(), null); + if (phpRuntime != null) { + newInterpreter.setInstallLocation(phpRuntime); PHPRuntime.getDefault().addInstalledInterpreter(newInterpreter); - interpreterCombo.add(newInterpreter.getName()); - interpreterCombo.select(interpreterCombo.indexOf(newInterpreter.getName())); + interpreterCombo.add(newInterpreter.getInstallLocation().toString()); + interpreterCombo.select(interpreterCombo.indexOf(newInterpreter.getInstallLocation().toString())); } } }); @@ -452,6 +464,12 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab { fRemoteDebugCheckBox.setSelection(DEFAULT_REMOTE_DEBUG); } try { + fRemoteDebugTranslate.setSelection(configuration.getAttribute( + PHPLaunchConfigurationAttribute.REMOTE_DEBUG_TRANSLATE, DEFAULT_REMOTE_DEBUG_TRANSLATE)); + } catch (CoreException ce) { + fRemoteDebugTranslate.setSelection(DEFAULT_REMOTE_DEBUG_TRANSLATE); + } + try { fOpenDBGSessionInBrowserCheckBox.setSelection(configuration.getAttribute( PHPLaunchConfigurationAttribute.OPEN_DBGSESSION_IN_BROWSER, DEFAULT_OPEN_DBGSESSION_IN_BROWSER)); } catch (CoreException ce) { @@ -540,13 +558,13 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab { String[] interpreterNames = new String[installedInterpretersWorkingCopy.size()]; for (int interpreterIndex = 0; interpreterIndex < installedInterpretersWorkingCopy.size(); interpreterIndex++) { PHPInterpreter interpreter = (PHPInterpreter) installedInterpretersWorkingCopy.get(interpreterIndex); - interpreterNames[interpreterIndex] = interpreter.getName(); + interpreterNames[interpreterIndex] = interpreter.getInstallLocation().toString(); } interpreterCombo.setItems(interpreterNames); PHPInterpreter selectedInterpreter = PHPRuntime.getDefault().getSelectedInterpreter(); if (selectedInterpreter != null) - interpreterCombo.select(interpreterCombo.indexOf(selectedInterpreter.getName())); + interpreterCombo.select(interpreterCombo.indexOf(selectedInterpreter.getInstallLocation().toString())); } public void performApply(ILaunchConfigurationWorkingCopy configuration) { @@ -567,6 +585,7 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab { // } configuration.setAttribute(PHPLaunchConfigurationAttribute.REMOTE_DEBUG, fRemoteDebugCheckBox.getSelection()); + configuration.setAttribute(PHPLaunchConfigurationAttribute.REMOTE_DEBUG_TRANSLATE, fRemoteDebugTranslate.getSelection()); configuration.setAttribute(PHPLaunchConfigurationAttribute.FILE_MAP, getMapFromPathMapTable()); configuration.setAttribute(PHPLaunchConfigurationAttribute.REMOTE_PATH, fRemoteSourcePath.getText()); configuration.setAttribute(PHPLaunchConfigurationAttribute.OPEN_DBGSESSION_IN_BROWSER, fOpenDBGSessionInBrowserCheckBox