From 460060bc80b4f06bd713cd5302e7ad9d3e7b2468 Mon Sep 17 00:00:00 2001 From: toshihiro Date: Wed, 22 Aug 2007 09:55:47 +0000 Subject: [PATCH 1/1] Fixed: 1777191 - Interpreter is required even if remote debugging --- .../debug/ui/launcher/PHPEnvironmentTab.java | 29 +++++++++++++------- .../launching/PHPLaunchConfigurationDelegate.java | 18 +++++++++--- 2 files changed, 32 insertions(+), 15 deletions(-) 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 50d3212..cd7ae8f 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 @@ -606,9 +606,7 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab { } catch (CoreException ce) { fRemoteDebugCheckBox.setSelection(DEFAULT_REMOTE_DEBUG); } - if (fRemoteDebugCheckBox.getSelection()) { - tabFolder.setSelection(0); - } + tabFolder.setSelection(fRemoteDebugCheckBox.getSelection() ? 0 : 1); try { fRemoteDebugTranslate.setSelection(configuration.getAttribute( PHPLaunchConfigurationAttribute.REMOTE_DEBUG_TRANSLATE, @@ -727,8 +725,16 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab { } catch (CoreException e) { log(e); } - if (interpreterName != null && !interpreterName.equals("")) + if (interpreterName != null && !interpreterName.equals("")) { interpreterCombo.select(interpreterCombo.indexOf(interpreterName)); + } + if (interpreterCombo.getSelectionIndex() < 0) { + // previous definition had been deleted + ((ILaunchConfigurationWorkingCopy) configuration).setAttribute( + PHPLaunchConfigurationAttribute.SELECTED_INTERPRETER, ""); + setErrorMessage(PHPDebugUiMessages + .getString("LaunchConfigurationTab.PHPEnvironment.interpreter_not_selected_error_message")); + } } protected void initializeInterpreterCombo(Combo interpreterCombo) { @@ -829,12 +835,15 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab { public boolean isValid(ILaunchConfiguration launchConfig) { try { - String selectedInterpreter = launchConfig.getAttribute( - PHPLaunchConfigurationAttribute.SELECTED_INTERPRETER, ""); - if (selectedInterpreter.length() == 0) { - setErrorMessage(PHPDebugUiMessages - .getString("LaunchConfigurationTab.PHPEnvironment.interpreter_not_selected_error_message")); - return false; + if (launchConfig.getAttribute( + PHPLaunchConfigurationAttribute.SELECTED_INTERPRETER, "") + .equals("")) { + if (!launchConfig.getAttribute( + PHPLaunchConfigurationAttribute.REMOTE_DEBUG, false)) { + setErrorMessage(PHPDebugUiMessages + .getString("LaunchConfigurationTab.PHPEnvironment.interpreter_not_selected_error_message")); + return false; + } } } catch (CoreException e) { log(e); diff --git a/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/PHPLaunchConfigurationDelegate.java b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/PHPLaunchConfigurationDelegate.java index d4c0680..1a7973f 100644 --- a/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/PHPLaunchConfigurationDelegate.java +++ b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/PHPLaunchConfigurationDelegate.java @@ -53,11 +53,19 @@ public class PHPLaunchConfigurationDelegate extends LaunchConfigurationDelegate */ public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException { - if (PHPRuntime.getDefault().getSelectedInterpreter() == null) { - String pid = PHPLaunchingPlugin.PLUGIN_ID; - String msg = "You must define an interpreter before running PHP."; - IStatus s = new Status(IStatus.ERROR, pid, IStatus.OK, msg, null); - throw new CoreException(s); + //if (PHPRuntime.getDefault().getSelectedInterpreter() == null) { + if (configuration.getAttribute( + PHPLaunchConfigurationAttribute.SELECTED_INTERPRETER, "") + .equals("")) { + if (!configuration.getAttribute( + PHPLaunchConfigurationAttribute.REMOTE_DEBUG, false) + && mode.equals("debug") || mode.equals("run")) { + String pid = PHPLaunchingPlugin.PLUGIN_ID; + String msg = "You must define an interpreter before running PHP."; + IStatus s = new Status(IStatus.ERROR, pid, IStatus.OK, msg, + null); + throw new CoreException(s); + } } InterpreterRunnerConfiguration conf = new InterpreterRunnerConfiguration( -- 1.7.1