1) Interpret the local to remote path mappings as project relative path to server...
[phpeclipse.git] / net.sourceforge.phpeclipse.debug.core / src / net / sourceforge / phpdt / internal / debug / core / PHPDBGProxy.java
index 595d64d..e93a7f1 100644 (file)
@@ -208,7 +208,11 @@ public class PHPDBGProxy {
         *
         */
        private String MapPath (PHPLineBreakpoint phpLBP) {
-               IPath filename;
+               IPath    filename;
+               IPath    remotePath;
+               IPath    newpath;
+               IPath    localPath;
+               String   local;
 
                if (remote) {
                        filename = phpLBP.getMarker().getResource().getProjectRelativePath();
@@ -231,14 +235,43 @@ public class PHPDBGProxy {
                        }
                }
 
-               if (pathtranslation && remote) {
-                       if (remoteSourcePath.toString ().substring (0, 1).equals ("/")) {
-                               path = path.replace ('/', '\\');
-                       }
-                       else {
-                               path = path.replace ('\\', '/');
+               if (remoteSourcePath.isEmpty ()) {
+                       if ((pathmap != null) && remote) {
+                               java.util.Iterator iterator = pathmap.keySet().iterator();
+
+                               while (iterator.hasNext ()) {
+                                       local      = (String) iterator.next ();                 // Get the local/client side path of the mapping
+                                       remotePath = new Path ((String) pathmap.get (local));   // Get the remote/server side path of the mapping
+                                       localPath  = new Path (local);                          // Get the remote/server side path of the mapping
+
+                                       if (localPath.isPrefixOf (filename)) {                  // Starts the remote/server side file path with the remote/server side mapping path
+                                                                                                                                                       // dann prefix abhängen und den remote path davorhägen
+                                               newpath = filename.removeFirstSegments (localPath.matchingFirstSegments (filename));
+                                               newpath = remotePath.append (newpath);
+                                               path    = newpath.toString ();
+
+                                               if (path.substring (0, 1).equals ("/")) {
+                                                       path = path.replace ('\\', '/');
+                                               }
+                                               else {
+                                                       path = path.replace ('/', '\\');
+                                               }
+
+                                               return path;
+                                       }
+                               }
                        }
-               }
+               }
+               else {
+                       if (pathtranslation && remote) {
+                               if (remoteSourcePath.toString ().substring (0, 1).equals ("/")) {
+                                       path = path.replace ('\\', '/');
+                               }
+                               else {
+                                       path = path.replace ('/', '\\');
+                               }
+                       }
+               }
 
                return path;
        }