Extended the builder with an index file generator for PHP class- and function-names.
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / phpeditor / PHPParserAction.java
index 7dc47c4..f5cbca0 100644 (file)
@@ -58,18 +58,26 @@ public class PHPParserAction extends TextEditorAction {
    */
   public void run() {
     boolean phpFlag = false;
+
+    //  try {
+    fileToParse = getPHPFile();
+    parseFile(fileToParse);
+  }
+
+  public static void parseFile(IFile fileToParse) {
+    boolean phpFlag = false;
     try {
-      fileToParse = getPHPFile();
+
       if (fileToParse == null) {
         // should never happen
         System.err.println("Error : no file in the editor");
         // should throw an exception
         return;
       }
-      String name = fileToParse.getName();
-      for (int i = 0; i<EXTENSIONS.length; i++) {
+      String name = fileToParse.getName().toLowerCase();
+      for (int i = 0; i < EXTENSIONS.length; i++) {
         if (name.endsWith(EXTENSIONS[i])) {
-          phpFlag = true;  // php file extension
+          phpFlag = true; // php file extension
           break;
         }
       }
@@ -79,10 +87,13 @@ public class PHPParserAction extends TextEditorAction {
           // first delete all the previous markers
           fileToParse.deleteMarkers(IMarker.PROBLEM, false, 0);
 
+          //the tasks are removed here
+          fileToParse.deleteMarkers(IMarker.TASK, false, 0);
+
           try {
             InputStream iStream = fileToParse.getContents();
             //        int c = iStream.read();
-            parse(iStream);
+            parse(fileToParse, iStream);
             iStream.close();
           } catch (IOException e) {
           }
@@ -94,7 +105,6 @@ public class PHPParserAction extends TextEditorAction {
     }
 
   }
-
   /**
    * Finds the file that's currently opened in the PHP Text Editor
    */
@@ -152,7 +162,7 @@ public class PHPParserAction extends TextEditorAction {
   //    return identifier.toString();
   //  }
 
-  protected void parse(InputStream iStream) {
+  protected static void parse(IFile fileToParse, InputStream iStream) {
 
     StringBuffer buf = new StringBuffer();
     int c0;