From: incastrix <incastrix>
Date: Sat, 14 Feb 2009 01:09:34 +0000 (+0000)
Subject: #757 - net.sourceforge.phpeclipse.xdebug.php.launching.PHPRemoteLaunchConfigurationDe... 
X-Git-Url: http://secure.phpeclipse.com?hp=6af1f8edb98acf1db80cd72ade8890cf40404d98

#757 - net.sourceforge.phpeclipse.xdebug.php.launching.PHPRemoteLaunchConfigurationDelegate.launch(ILaunchConfiguration, String, ILaunch, IProgressMonitor) now checks if pathmap existand eventually throws an exception. Add to net.sourceforge.phpeclipse.xdebug.ui.php.launching.PHPPathMapTab overrided of org.eclipse.debug.ui.AbstractLaunchConfigurationTab.isValid(ILaunchConfiguration).
---

diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/launching/PHPRemoteLaunchConfigurationDelegate.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/launching/PHPRemoteLaunchConfigurationDelegate.java
index c003bcc..88f6f4b 100644
--- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/launching/PHPRemoteLaunchConfigurationDelegate.java
+++ b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/launching/PHPRemoteLaunchConfigurationDelegate.java
@@ -1,5 +1,7 @@
 package net.sourceforge.phpeclipse.xdebug.php.launching;
 
+import java.util.List;
+
 import net.sourceforge.phpeclipse.xdebug.core.IProxyEventListener;
 import net.sourceforge.phpeclipse.xdebug.core.XDebugCorePlugin;
 import net.sourceforge.phpeclipse.xdebug.core.XDebugProxy;
@@ -18,7 +20,7 @@ import org.eclipse.debug.core.model.IDebugTarget;
 //import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
 import org.eclipse.debug.core.model.LaunchConfigurationDelegate;
 
-public class PHPRemoteLaunchConfigurationDelegate extends LaunchConfigurationDelegate /*implements ILaunchConfigurationDelegate*/ {
+public class PHPRemoteLaunchConfigurationDelegate extends LaunchConfigurationDelegate {
 	public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
 		String projectName = configuration.getAttribute(IXDebugConstants.ATTR_PHP_PROJECT, (String)null);
 		IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
@@ -27,6 +29,11 @@ public class PHPRemoteLaunchConfigurationDelegate extends LaunchConfigurationDel
 			abort("Project does not exist.", null);
 		}
 
+		 List l = configuration.getAttribute(IXDebugConstants.ATTR_PHP_PATHMAP, (List) null);
+		if(l == null) {
+			abort("The project isn't properly mapped to remote.", null);			
+		}
+
 		XDebugProxy proxy = XDebugCorePlugin.getDefault().getXDebugProxy();
 		proxy.start();
 		String ideID = configuration.getAttribute(IXDebugConstants.ATTR_PHP_IDE_ID, "testID");
diff --git a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/PHPPathMapTab.java b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/PHPPathMapTab.java
index 0992e5d..93ac7cb 100644
--- a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/PHPPathMapTab.java
+++ b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/PHPPathMapTab.java
@@ -16,6 +16,8 @@ import net.sourceforge.phpeclipse.xdebug.ui.MultipleInputDialog;
 import net.sourceforge.phpeclipse.xdebug.ui.php.launching.PHPEnvironmentTab.EnvironmentVariableContentProvider;
 import net.sourceforge.phpeclipse.xdebug.ui.php.launching.PHPEnvironmentTab.EnvironmentVariableLabelProvider;
 */
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IStatus;
@@ -470,6 +472,20 @@ public class PHPPathMapTab extends AbstractLaunchConfigurationTab {
 		}
 	}
 
+	/* (non-Javadoc)
+	 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#isValid(org.eclipse.debug.core.ILaunchConfiguration)
+	 */
+	public boolean isValid(ILaunchConfiguration launchConfig) {
+		// need to use exception here!
+		setErrorMessage(null);
+		
+		if (fPathMapTable.getTable().getItems().length == 0) {
+			setErrorMessage("Mappath empty!");
+			return false;
+		}
+		return true;
+	}
+		
 	public String getName() {
 		return "Pathmap";
 	}