**********************************************************************/
package net.sourceforge.phpeclipse.phpeditor;
-import java.io.FileReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
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.PHPFunction;
import net.sourceforge.phpeclipse.phpeditor.php.PHPWordExtractor;
import org.eclipse.core.resources.IProject;
* Implementation for an <code>ITextHover</code> which hovers over PHP code.
*/
public class PHPTextHover implements ITextHover {
- public static HashMap functionDescriptions = null;
+ private static HashMap functionDescriptions = null;
- private static PHPWordExtractor phpWordDetector = new PHPWordExtractor();
+ private static HashMap identDescriptions = null;
/**
* The current project; maybe <code>null</code> for preference pages
String word = textViewer.getDocument().get(hoverRegion.getOffset(), hoverRegion.getLength());
if (functionDescriptions == null) {
functionDescriptions = new HashMap();
+ identDescriptions = new HashMap();
ArrayList syntaxbuffer = PHPSyntaxRdr.getSyntaxData();
- String strbuffer = null;
PHPElement elbuffer = null;
if (syntaxbuffer != null) {
for (int i = 0; i < syntaxbuffer.size(); i++) {
elbuffer = (PHPElement) syntaxbuffer.get(i);
- functionDescriptions.put(elbuffer.getName(), elbuffer.getHoverText());
+ if (elbuffer instanceof PHPFunction) {
+ functionDescriptions.put(elbuffer.getName(), elbuffer.getHoverText());
+ } else {
+ identDescriptions.put(elbuffer.getName(), elbuffer.getHoverText());
+ }
}
}
//
// elbuffer.getHoverText());
// }
}
- String hoverInfo = (String) functionDescriptions.get(word);
+ String hoverInfo = (String) identDescriptions.get(word);
if (hoverInfo == null & word.length() > 0) {
hoverInfo = (String) functionDescriptions.get(word.toLowerCase());
}
try {
PHPIdentifierLocation location;
String filename;
- FileReader phpdocFileReader;
StringBuffer hoverInfoBuffer = new StringBuffer();
String workspaceLocation;
if (fProject != null) {