import net.sourceforge.phpeclipse.builder.FileStorage;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.model.IPersistableSourceLocator;
import org.eclipse.debug.core.model.IStackFrame;
import org.eclipse.ui.part.FileEditorInput;
public class PHPSourceLocator implements IPersistableSourceLocator, ISourcePresentation {
- private String absoluteWorkingDirectory;
+ //private String absoluteWorkingDirectory;
private Map pathMap = null;
private boolean remoteDebug;
private IPath remoteSourcePath;
}
- public String getAbsoluteWorkingDirectory() {
- return absoluteWorkingDirectory;
- }
+// public String getAbsoluteWorkingDirectory() {
+// return absoluteWorkingDirectory;
+// }
/**
* @see org.eclipse.debug.core.model.IPersistableSourceLocator#getMemento()
* @see org.eclipse.debug.core.model.IPersistableSourceLocator#initializeDefaults(ILaunchConfiguration)
*/
public void initializeDefaults (ILaunchConfiguration configuration) throws CoreException {
- this.absoluteWorkingDirectory = configuration.getAttribute (PHPLaunchConfigurationAttribute.WORKING_DIRECTORY, "");
+ //this.absoluteWorkingDirectory = configuration.getAttribute (PHPLaunchConfigurationAttribute.WORKING_DIRECTORY, "");
this.remoteDebug = configuration.getAttribute (PHPLaunchConfigurationAttribute.REMOTE_DEBUG,false);
this.pathMap = configuration.getAttribute (PHPLaunchConfigurationAttribute.FILE_MAP, (Map)null);
this.projectName = configuration.getAttribute (PHPLaunchConfigurationAttribute.PROJECT_NAME, "");
IPath localPath;
Iterator iterator;
String fileName;
- String file;
+ //String file;
String local;
fileName = ((PHPStackFrame) stackFrame).getFileName (); // Get the filename as it is submitted by DBG
- file = "";
+ //file = "";
if (remoteDebug) { // Is it a remote debugging session
path = new Path (fileName); // Create a IPath object for the server side filename
if (!remoteSourcePath.isEmpty()) {
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
+ //file = path.toString (); // The filename without the remote source path
projectPath = (PHPeclipsePlugin.getWorkspace().getRoot().getProject(projectName).getLocation()); // Get the absolute project path
return (projectPath.append (path)).toOSString (); // Return the filename as absolute client side path
}
return fileName;
- } else {
+
+ } else {
+
+ IWorkspaceRoot root = PHPLaunchingPlugin.getWorkspace().getRoot();
+ Path filePath = new Path(fileName);
+
+ if (root.getFileForLocation(filePath) == null) {
+ 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();
+ break;
+ }
+ }
+ }
+
return fileName;
}
}