Bug 841370 - open declaration for projects wih external workspace
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / actions / PHPOpenIncludeEditorAction.java
index fdb8907..77173a7 100644 (file)
@@ -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 {