package net.sourceforge.phpeclipse.xdebug.php.launching;
+import java.net.URI;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.model.IStackFrame;
import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupParticipant;
import org.eclipse.debug.core.sourcelookup.ISourceContainer;
String local;
List pathMap;
PathMapItem pmi = null;
+ Object test;
+ IProject project;
projectName = getDirector().getLaunchConfiguration().getAttribute (IXDebugConstants.ATTR_PHP_PROJECT, "");
- pathMap = getDirector().getLaunchConfiguration().getAttribute(IXDebugConstants.ATTR_PHP_PATHMAP, (List) null);
-
+ pathMap = getDirector().getLaunchConfiguration().getAttribute (IXDebugConstants.ATTR_PHP_PATHMAP, (List) null);
+ project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+
+ if (getDirector ().getLaunchConfiguration ().getType ().getName ().equals ("PHP XDebug Script")) {
+ remoteDebug = false;
+ }
+ else {
+ remoteDebug = true;
+ }
+
fileName = ((XDebugStackFrame) stackFrame).getFullSourceName (); // Get the filename as it is submitted by XDebug
- //file = "";
if (remoteDebug) { // Is it a remote debugging session
path = new Path (fileName); // Create a IPath object for the server side filename
if (remoteSourcePath.isPrefixOf (path)) { // Is the server side filename with the remote source path
path = path.removeFirstSegments (remoteSourcePath.matchingFirstSegments (path)); // Remove the remote source path
//file = path.toString (); // The filename without the remote source path
- projectPath = (PHPeclipsePlugin.getWorkspace().getRoot().getProject(projectName).getLocation()); // Get the absolute project path
+ projectPath = (ResourcesPlugin.getWorkspace().getRoot().getProject(projectName).getLocation()); // Get the absolute project path
return (projectPath.append (path)).toOSString (); // Return the filename as absolute client side path
}
localPath = new Path (local); // Create new IPath object for the local/client side path
path = localPath.append (path); // Prepend the project relative path to filename
- projectPath = (PHPeclipsePlugin.getWorkspace().getRoot().getProject(projectName).getLocation()); // Get the absolute project path
+ projectPath = (ResourcesPlugin.getWorkspace().getRoot().getProject(projectName).getLocation()); // Get the absolute project path
// return path;
return (projectPath.append (path)).toString (); // Return the filename as absolute client side path
return fileName;
} else { // no remote debug
-/*
- IWorkspaceRoot root = PHPLaunchingPlugin.getWorkspace().getRoot();
- Path filePath = new Path(fileName);
-
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ IPath filePath = new Path(fileName);
+
if (root.getFileForLocation(filePath) == null) {
- IProject proj = root.getProject(projectName);
- IFile[] files = root.findFilesForLocation(filePath);
+ IProject proj = root.getProject (projectName);
+ IFile[] files = root.findFilesForLocation (filePath);
+
for (int i = 0; i < files.length; i++) {
if (files[i].getProject().equals(proj)) {
fileName = proj.getFullPath().append(files[i].getProjectRelativePath()).toOSString();
}
}
}
-*/
+ else {
+ projectPath = (ResourcesPlugin.getWorkspace().getRoot().getProject(projectName).getLocation());
+ filePath = filePath.removeFirstSegments (projectPath.matchingFirstSegments (filePath));
+
+ return filePath.toString ();
+ }
+
return fileName;
}
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant#findSourceElements(java.lang.Object)
*/
- public Object[] findSourceElements(Object object) throws CoreException {
+ public Object[] findSourceElements (Object object) throws CoreException {
String name = null;
if (object == null) {
import org.eclipse.core.resources.IMarkerDelta;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.DebugPlugin;
hitCount = Integer.parseInt(attribute.getNodeValue());
}
}
-
- if(PHPDebugUtils.unescapeString(filename).endsWith(endfilename)
+
+ Path path1 = new Path (PHPDebugUtils.unescapeString (filename));
+ Path path2 = new Path (endfilename);
+
+ if (path1.toString ().endsWith (path2.toString ())
+// if (strPath1.endsWith (strPath2)
+ //if(PHPDebugUtils.unescapeString(filename).endsWith(endfilename)
&& (lineBreakpoint.getLineNumber() == lineNumber) ) {
if (marker.getAttribute(XDebugLineBreakpoint.HIT_COUNT, 0) > 0) {
if (marker.getAttribute(XDebugLineBreakpoint.HIT_COUNT, 0) == hitCount) {