Delete association of htmledit.gif for the PHPUnitEditor
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / phpeditor / PHPParserAction.java
index 02ca163..6197bae 100644 (file)
@@ -1,16 +1,16 @@
 package net.sourceforge.phpeclipse.phpeditor;
 
 /**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
+ Copyright (c) 2000, 2002 IBM Corp. and others.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Common Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/cpl-v10.html
 
-Contributors:
-    IBM Corporation - Initial implementation
-    www.phpeclipse.de
-**********************************************************************/
+ Contributors:
+ IBM Corporation - Initial implementation
+ www.phpeclipse.de
+ **********************************************************************/
 
 import java.io.BufferedInputStream;
 import java.io.IOException;
@@ -41,6 +41,7 @@ public class PHPParserAction extends TextEditorAction {
   private static PHPParserAction instance = new PHPParserAction();
 
   protected IFile fileToParse;
+
   protected List fVariables = new ArrayList(100);
 
   /**
@@ -68,35 +69,23 @@ public class PHPParserAction extends TextEditorAction {
 
   public static void parseFile(IFile fileToParse) {
     boolean phpFlag = false;
-//    try {
+    //    try {
 
-      if (fileToParse == null) {
-        // TODO should never happen => should throw an exception
-        System.err.println("Error : no file in the editor");
+    if (fileToParse == null) {
+      // TODO should never happen => should throw an exception
+      System.err.println("Error : no file in the editor");
 
-        return;
-      }
-      // TODO use isPHPFile()
-      String name = fileToParse.getName(); //.toLowerCase();
-//      for (int i = 0; i < EXTENSIONS.length; i++) {
-//        if (name.endsWith(EXTENSIONS[i])) {
-//        if (PHPFileUtil.isPHPFileName(name)) {
-//          phpFlag = true; // php file extension
-//          break;
-//        }
-//      }
-//      if (phpFlag) {
-      if (PHPFileUtil.isPHPFileName(name)) {
-        IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
-//        if (store.getString(PHPeclipsePlugin.PHP_PARSER_DEFAULT).equals(PHPeclipsePlugin.PHP_INTERNAL_PARSER)) {
-//          PHPBuilder.removeProblemsAndTasksFor(fileToParse);
-//          parse(fileToParse); //, iStream);
-//        } else {
-          ExternalPHPParser parser = new ExternalPHPParser(fileToParse);
-          parser.phpExternalParse();
-//        }
-      }
+      return;
+    }
+    String name = fileToParse.getName(); //.toLowerCase();
+
+    if (PHPFileUtil.isPHPFileName(name)) {
+      IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
+      ExternalPHPParser parser = new ExternalPHPParser(fileToParse);
+      parser.phpExternalParse();
+    }
   }
+
   /**
    * Finds the file that's currently opened in the PHP Text Editor
    */
@@ -115,9 +104,6 @@ public class PHPParserAction extends TextEditorAction {
     return null;
   }
 
-  
-
-  
   protected static void parse(IFile fileToParse) {
     InputStream stream = null;
     char[] charArray;
@@ -130,9 +116,9 @@ public class PHPParserAction extends TextEditorAction {
     } catch (IOException e) {
     } finally {
       try {
-       if (stream!=null) {
+        if (stream != null) {
           stream.close();
-       }
+        }
       } catch (IOException e) {
       }
     }