From: khartlage Date: Fri, 11 Jun 2004 17:58:43 +0000 (+0000) Subject: improved include detection X-Git-Url: http://git.phpeclipse.com improved include detection --- diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPOpenIncludeEditorAction.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPOpenIncludeEditorAction.java index fdb8907..77173a7 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPOpenIncludeEditorAction.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPOpenIncludeEditorAction.java @@ -71,10 +71,27 @@ public class PHPOpenIncludeEditorAction extends ActionDelegate implements IEdito return editorInput.getFile().getParent(); } private IFile getIncludeFile(IProject project, IFileEditorInput editorInput, String relativeFilename) { - // IContainer container = getWorkingLocation(editorInput); - // String fullPath = project.getLocation().toString(); - Path path = new Path(relativeFilename); - IFile file = project.getFile(path); + IContainer container = getWorkingLocation(editorInput); + String fullPath = project.getLocation().toString(); + IFile file = null; + if (relativeFilename.startsWith("../")) { + Path path = new Path(relativeFilename); + file = container.getFile(path); + return file; + } + int index = relativeFilename.lastIndexOf('/'); + + if (index >= 0) { + Path path = new Path(relativeFilename); + file = project.getFile(path); + if (file.exists()) { + return file; + } + } + + Path path = new Path(relativeFilename); + file = container.getFile(path); + return file; } @@ -105,7 +122,7 @@ public class PHPOpenIncludeEditorAction extends ActionDelegate implements IEdito return; } } catch (Exception e) { -// ignore + // ignore } try {