Fixed: 1493208 - Linked resources break code assist / includes
authortoshihiro <toshihiro>
Wed, 13 Jun 2007 07:38:26 +0000 (07:38 +0000)
committertoshihiro <toshihiro>
Wed, 13 Jun 2007 07:38:26 +0000 (07:38 +0000)
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/PHPFileUtil.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/OpenDeclarationEditorAction.java

index d17c8e4..9e8563e 100644 (file)
@@ -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) {
index 6d4e18b..9c35add 100644 (file)
@@ -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