bug fix: HTML Context information should be show properlyfor completion processor
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / builder / IdentifierIndexManager.java
index 1b0be9e..1047779 100644 (file)
@@ -8,10 +8,13 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Comparator;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
+import java.util.SortedMap;
 import java.util.StringTokenizer;
+import java.util.TreeMap;
 
 import net.sourceforge.phpdt.core.compiler.ITerminalSymbols;
 import net.sourceforge.phpdt.core.compiler.InvalidInputException;
@@ -236,9 +239,22 @@ public class IdentifierIndexManager {
     }
   }
 
+       class StringComparator implements Comparator { 
+               public int compare(Object o1, Object o2) { 
+                       String s1 = (String)o1; 
+                       String s2 = (String)o2; 
+                       return s1.compareTo(s2); 
+               //      return s1.toUpperCase().compareTo(s2.toUpperCase()); 
+               }                                     
+               public boolean equals(Object o) { 
+                       String s = (String)o; 
+                       return compare(this, o)==0; 
+               } 
+       } 
+
   private HashMap fFileMap;
   private String fFilename;
-  private HashMap fIndentifierMap;
+  private TreeMap fIndentifierMap;
 
   public IdentifierIndexManager(String filename) {
     fFilename = filename;
@@ -405,7 +421,7 @@ public class IdentifierIndexManager {
    *
    */
   public void initialize() {
-    fIndentifierMap = new HashMap();
+    fIndentifierMap = new TreeMap(new StringComparator());
     fFileMap = new HashMap();
   }
 
@@ -543,4 +559,14 @@ public class IdentifierIndexManager {
       e.printStackTrace();
     }
   }
+  
+  /**
+   * @param fromKey
+   * @param toKey
+   * @return
+   */
+  public SortedMap getIdentifierMap() {
+    return fIndentifierMap;
+  }
+
 }
\ No newline at end of file