fix from durel_b:
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / phpeditor / PHPSyntaxRdr.java
index 20f6404..591542c 100644 (file)
@@ -7,7 +7,7 @@ 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 +59,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 +164,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 +185,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 +203,8 @@ public class PHPSyntaxRdr {
                }
        }
 
-       public static Vector getUserDefinitions() {
-               return (Vector) userdefsyntaxdata.clone();
+       public static ArrayList getUserSyntaxData() {
+               return userdefsyntaxdata;
        }
 
        private static File getSyntaxFile() {
@@ -298,14 +303,14 @@ public class PHPSyntaxRdr {
        private static void throwReadException(Throwable t) throws CoreException {
                PHPeclipsePlugin.log(t);
                //              IStatus status= new JavaUIStatus(JavaStatusConstants.TEMPLATE_IO_EXCEPTION,
-               //                      TemplateMessages.getString("TemplateSet.error.read"), t); //$NON-NLS-1$
+               //                      ObfuscatorMessages.getString("TemplateSet.error.read"), t); //$NON-NLS-1$
                //              throw new JavaUIException(status);
        }
 
        private static void throwWriteException(Throwable t) throws CoreException {
                PHPeclipsePlugin.log(t);
                //              IStatus status= new JavaUIStatus(JavaStatusConstants.TEMPLATE_IO_EXCEPTION,
-               //                      TemplateMessages.getString("TemplateSet.error.write"), t); //$NON-NLS-1$
+               //                      ObfuscatorMessages.getString("TemplateSet.error.write"), t); //$NON-NLS-1$
                //              throw new JavaUIException(status);
        }