From 459a64000c56a2700340638a88d861aba2c04310 Mon Sep 17 00:00:00 2001 From: toshihiro Date: Wed, 13 Jun 2007 07:38:26 +0000 Subject: [PATCH] Fixed: 1493208 - Linked resources break code assist / includes --- .../phpdt/internal/ui/util/PHPFileUtil.java | 12 +++++++++++- .../actions/OpenDeclarationEditorAction.java | 15 +++++++++------ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/PHPFileUtil.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/PHPFileUtil.java index d17c8e4..9e8563e 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/PHPFileUtil.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/PHPFileUtil.java @@ -10,9 +10,11 @@ import java.util.List; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import net.sourceforge.phpeclipse.ui.overlaypages.ProjectPrefUtil; +import org.eclipse.core.filebuffers.FileBuffers; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; import org.eclipse.ui.IEditorDescriptor; @@ -182,7 +184,15 @@ public class PHPFileUtil { if (file.exists()) { return path; } - // } + + // check if linked resource + IFile ifile = FileBuffers.getWorkspaceFileAtLocation(path); + if (ifile != null) { + file = ifile.getLocation().toFile(); + if (file.exists()) { + return path; + } + } List includePaths = ProjectPrefUtil.getIncludePaths(project); if (includePaths.size() > 0) { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/OpenDeclarationEditorAction.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/OpenDeclarationEditorAction.java index 6d4e18b..9c35add 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/OpenDeclarationEditorAction.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/OpenDeclarationEditorAction.java @@ -82,12 +82,15 @@ public class OpenDeclarationEditorAction { IPath path = PHPFileUtil.determineFilePath(filename, currentFile, fProject); if (path != null) { - IFile file = PHPFileUtil.createFile(path, fProject); - if (file != null && file.exists()) { - PHPeclipsePlugin.getDefault().openFileInTextEditor( - file.getLocation().toString()); - return; - } + //IFile file = PHPFileUtil.createFile(path, fProject); + //if (file != null && file.exists()) { + // PHPeclipsePlugin.getDefault().openFileInTextEditor( + // file.getLocation().toString()); + // return; + //} + PHPeclipsePlugin.getDefault().openFileInTextEditor( + path.toString()); + return; } } catch (Exception e) { // ignore -- 1.7.1