Ignore case for functions in the PHP hover
authoraxelcl <axelcl>
Mon, 29 Aug 2005 16:34:33 +0000 (16:34 +0000)
committeraxelcl <axelcl>
Mon, 29 Aug 2005 16:34:33 +0000 (16:34 +0000)
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPTextHover.java

index 22e1470..ba13146 100644 (file)
@@ -21,6 +21,7 @@ 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.PHPFunction;
 import net.sourceforge.phpeclipse.phpeditor.php.PHPWordExtractor;
 
 import org.eclipse.core.resources.IProject;
@@ -34,9 +35,9 @@ import org.eclipse.swt.graphics.Point;
  * 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
@@ -57,13 +58,18 @@ public class PHPTextHover implements ITextHover {
                                        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());
+                                                               }
                                                        }
                                                }
                                                //
@@ -74,7 +80,7 @@ public class PHPTextHover implements ITextHover {
                                                // 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());
                                        }