Version 1.1.7
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / phpeditor / PHPTextHover.java
index 5535560..81b66fe 100644 (file)
@@ -7,19 +7,21 @@
 
  Contributors:
  IBM Corporation - Initial implementation
- Klaus Hartlage - www.eclipseproject.de
+ www.phpeclipse.de
  **********************************************************************/
 package net.sourceforge.phpeclipse.phpeditor;
 import java.io.FileReader;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
+
 import net.sourceforge.phpdt.internal.corext.phpdoc.PHPDocUtil;
 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
 import net.sourceforge.phpeclipse.builder.IdentifierIndexManager;
 import net.sourceforge.phpeclipse.builder.PHPIdentifierLocation;
 import net.sourceforge.phpeclipse.phpeditor.php.PHPElement;
 import net.sourceforge.phpeclipse.phpeditor.php.PHPWordExtractor;
+
 import org.eclipse.core.resources.IProject;
 import org.eclipse.jface.text.IRegion;
 import org.eclipse.jface.text.ITextHover;
@@ -68,7 +70,8 @@ public class PHPTextHover implements ITextHover {
             // elbuffer.getHoverText());
             //            }
           }
-          String hoverInfo = (String) functionDescriptions.get(word);
+          String hoverInfo = 
+            (String) functionDescriptions.get(word);
           if (hoverInfo == null && fProject != null) {
             // get the possible PHPDoc information from the index file
             IdentifierIndexManager indexManager = PHPeclipsePlugin.getDefault()
@@ -80,8 +83,14 @@ public class PHPTextHover implements ITextHover {
                 String filename;
                 FileReader phpdocFileReader;
                 StringBuffer hoverInfoBuffer = new StringBuffer();
-                String workspaceLocation = PHPeclipsePlugin.getWorkspace()
-                    .getRoot().getLocation().toString();
+                String workspaceLocation;
+                if (fProject!=null) {
+                  workspaceLocation = fProject.getLocation().toString()+'/';
+                } else {
+                  // should never happen?
+                  workspaceLocation = PHPeclipsePlugin.getWorkspace()
+                  .getRoot().getLocation().toString();
+                }
                 //                boolean foundPHPdoc = false;
                 for (int i = 0; i < list.size(); i++) {
                   location = (PHPIdentifierLocation) list.get(i);