Deleted PHPFunctionNames use only phpsyntax.xml instead !
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / phpeditor / PHPSyntaxRdr.java
index a9b162e..571cc66 100644 (file)
@@ -7,7 +7,8 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.UnsupportedEncodingException;
-import java.util.Vector;
+import java.util.ArrayList;
+
 
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
@@ -59,12 +60,13 @@ public class PHPSyntaxRdr {
        //the suers custom file - if that file should be changed,
        //then all entries in this variable should be removed from
        //the word list, reread from the file and then reinserted.
-       private static Vector userdefsyntaxdata;
+       private static ArrayList userdefsyntaxdata;
 
-       private static Vector syntaxdata;
+       private static ArrayList syntaxdata;
 
        public PHPSyntaxRdr() {
-               syntaxdata = new Vector();
+               // see getSyntaxData()
+               syntaxdata = null;
                store = PHPeclipsePlugin.getDefault().getPreferenceStore();
        }
 
@@ -163,15 +165,15 @@ public class PHPSyntaxRdr {
                                        //ignore as it is not a valid phpsyntax tag
                                } else {
                                        if (Keyword != null) {
-                                               syntaxdata.addElement(
+                                               syntaxdata.add(
                                                        new PHPKeyword(Keyword, usage, Tokenval));
                                        } else if (Type != null) {
-                                               syntaxdata.addElement(new PHPType(Type, usage));
+                                               syntaxdata.add(new PHPType(Type, usage));
                                        } else if (Function != null) {
-                                               syntaxdata.addElement(
+                                               syntaxdata.add(
                                                        new PHPFunction(Function, usage, description));
                                        } else if (Constant != null) {
-                                               syntaxdata.addElement(new PHPConstant(Constant, usage));
+                                               syntaxdata.add(new PHPConstant(Constant, usage));
                                        }
                                }
                        }
@@ -184,8 +186,12 @@ public class PHPSyntaxRdr {
                }
        }
 
-       public static Vector getsyntaxdata() {
-               return (Vector) syntaxdata.clone();
+       public static ArrayList getSyntaxData() {
+               if (syntaxdata==null) {
+                       syntaxdata = new ArrayList();
+                       readInSyntax();
+               }
+               return syntaxdata;
        }
 
        public static void replaceUserDefFile() {
@@ -198,8 +204,8 @@ public class PHPSyntaxRdr {
                }
        }
 
-       public static Vector getUserDefinitions() {
-               return (Vector) userdefsyntaxdata.clone();
+       public static ArrayList getUserSyntaxData() {
+               return userdefsyntaxdata;
        }
 
        private static File getSyntaxFile() {