From 1ad7e82ae0807f1e152fef70a08e0136e9522b0d Mon Sep 17 00:00:00 2001 From: khartlage Date: Fri, 11 Jun 2004 17:58:43 +0000 Subject: [PATCH] improved include detection --- .../actions/PHPOpenIncludeEditorAction.java | 27 ++++++++++++++++--- 1 files changed, 22 insertions(+), 5 deletions(-) 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 { -- 1.7.1