From 385bff0f106c2fb1f1565e3a9346fc5dd178c613 Mon Sep 17 00:00:00 2001 From: toshihiro Date: Wed, 15 Aug 2007 08:21:47 +0000 Subject: [PATCH 1/1] Fixed: Editor open a file in R/O (as external) when debugging a file under linked folder. --- .../phpdt/internal/launching/PHPSourceLocator.java | 21 ++++++++++++++++++- 1 files changed, 19 insertions(+), 2 deletions(-) diff --git a/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/PHPSourceLocator.java b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/PHPSourceLocator.java index 03a163c..d395616 100644 --- a/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/PHPSourceLocator.java +++ b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/PHPSourceLocator.java @@ -9,11 +9,12 @@ import net.sourceforge.phpeclipse.builder.ExternalEditorInput; 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; @@ -144,7 +145,23 @@ public class PHPSourceLocator implements IPersistableSourceLocator, ISourcePrese } 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.getLocation().append(files[i].getProjectRelativePath()).toOSString(); + break; + } + } + } + return fileName; } } -- 1.7.1