X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPParserAction.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPParserAction.java index 38534c7..02ca163 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPParserAction.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPParserAction.java @@ -9,7 +9,7 @@ http://www.eclipse.org/legal/cpl-v10.html Contributors: IBM Corporation - Initial implementation - Klaus Hartlage - www.eclipseproject.de + www.phpeclipse.de **********************************************************************/ import java.io.BufferedInputStream; @@ -19,7 +19,7 @@ import java.util.ArrayList; import java.util.List; import net.sourceforge.phpdt.internal.compiler.util.Util; -import net.sourceforge.phpdt.internal.core.builder.PHPBuilder; +import net.sourceforge.phpdt.internal.ui.util.PHPFileUtil; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import net.sourceforge.phpeclipse.actions.ExternalPHPParser; @@ -39,7 +39,6 @@ import org.eclipse.ui.texteditor.TextEditorAction; public class PHPParserAction extends TextEditorAction { private static PHPParserAction instance = new PHPParserAction(); - private static String[] EXTENSIONS = { ".php", ".php3", ".php4", ".inc", ".phtml" }; protected IFile fileToParse; protected List fVariables = new ArrayList(100); @@ -78,36 +77,25 @@ public class PHPParserAction extends TextEditorAction { return; } // TODO use isPHPFile() - String name = fileToParse.getName().toLowerCase(); - for (int i = 0; i < EXTENSIONS.length; i++) { - if (name.endsWith(EXTENSIONS[i])) { - phpFlag = true; // php file extension - break; - } - } - if (phpFlag) { + 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)) { -// // first delete all the previous markers -// fileToParse.deleteMarkers(IMarker.PROBLEM, false, 0); -// -// //the tasks are removed here -// fileToParse.deleteMarkers(IMarker.TASK, false, 0); - PHPBuilder.removeProblemsAndTasksFor(fileToParse); - // try { - // InputStream iStream = fileToParse.getContents(); - parse(fileToParse); //, iStream); - // iStream.close(); - // } catch (IOException e) { - // } - } else { +// 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(); - } +// } } -// } catch (CoreException e) { -// } - } /** * Finds the file that's currently opened in the PHP Text Editor