From b0f299d4bb672720312967dcbbdf2310e430c33a Mon Sep 17 00:00:00 2001 From: cperkonig Date: Wed, 5 Oct 2005 08:09:37 +0000 Subject: [PATCH] Changes for the XDebugTab --- .../xdebug/php/launching/IXDebugConstants.java | 4 +++ .../launching/PHPLaunchConfigurationDelegate.java | 24 ++++++++++---------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/launching/IXDebugConstants.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/launching/IXDebugConstants.java index 4aae1ed..81007f3 100644 --- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/launching/IXDebugConstants.java +++ b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/launching/IXDebugConstants.java @@ -28,6 +28,10 @@ public interface IXDebugConstants { public static final String ATTR_PHP_INTERPRETER = ID_PHP_DEBUG_MODEL + ".ATTR_PHP_INTERPRETER"; + public static final String ATTR_PHP_DEFAULT_DEBUGPORT = ID_PHP_DEBUG_MODEL + ".ATTR_PHP_DEFAULT_DEBUGPORT"; + + public static final String ATTR_PHP_DEBUGPORT = ID_PHP_DEBUG_MODEL + ".ATTR_PHP_DEBUGPORT"; + } diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/launching/PHPLaunchConfigurationDelegate.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/launching/PHPLaunchConfigurationDelegate.java index 509d40d..be1286b 100644 --- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/launching/PHPLaunchConfigurationDelegate.java +++ b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/launching/PHPLaunchConfigurationDelegate.java @@ -52,38 +52,38 @@ public class PHPLaunchConfigurationDelegate extends LaunchConfigurationDelegate phpInterpreter=XDebugCorePlugin.getDefault().getPreferenceStore().getString(IXDebugPreferenceConstants.PHP_INTERPRETER_PREFERENCE); File exe = new File(phpInterpreter); + // Just to get sure that the interpreter exists if (!exe.exists()) { abort(MessageFormat.format("Specified PHP executable {0} does not exist. Check value of PHP-Interpreter.", new String[]{phpInterpreter}), null); } commandList.add(phpInterpreter); - // program name + // Project name String projectName = configuration.getAttribute(IXDebugConstants.ATTR_PHP_PROJECT, (String)null); IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); - +// Just to get sure that the project exists if (project == null) { - abort("PHP-Script unspecified.", null); + abort("Project does not exist.", null); } String fileName = configuration.getAttribute(IXDebugConstants.ATTR_PHP_FILE, (String)null); -// String program = project.getFile(fileName); IFile file = project.getFile(fileName); -// IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(program)); + // Just to get sure that the script exists if (!file.exists()) { abort(MessageFormat.format("PHP-Script {0} does not exist.", new String[] {file.getFullPath().toString()}), null); } commandList.add(file.getLocation().toOSString()); -// Map nativeEnvVars = DebugPlugin.getDefault().getLaunchManager().getNativeEnvironment(); - // Environment variables String[] envp=DebugPlugin.getDefault().getLaunchManager().getEnvironment(configuration); - // Map envVars=configuration.getAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, nativeEnvVars); - int debugPort=XDebugCorePlugin.getDefault().getPreferenceStore().getInt(IXDebugPreferenceConstants.DEBUGPORT_PREFERENCE); + + // Get de Debugport form the Launchconfiguration or from the preferences + int debugPort = configuration.getAttribute(IXDebugConstants.ATTR_PHP_DEBUGPORT,-1); + boolean useDefaultPort= configuration.getAttribute(IXDebugConstants.ATTR_PHP_DEFAULT_DEBUGPORT, true); + if (useDefaultPort) + debugPort=XDebugCorePlugin.getDefault().getPreferenceStore().getInt(IXDebugPreferenceConstants.DEBUGPORT_PREFERENCE); if (debugPort<1024) debugPort=IXDebugPreferenceConstants.DEFAULT_DEBUGPORT; -// if (mode.equals(ILaunchManager.DEBUG_MODE)) { -// nativeEnvVars.put("XDEBUG_CONFIG", "idekey=xdebug_test remote_enable=1"); -// } + if (mode.equals(ILaunchManager.DEBUG_MODE)) { String[] env; if (envp!=null) { -- 1.7.1