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 fbef0f3..6197bae 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPParserAction.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPParserAction.java @@ -1,34 +1,37 @@ 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 - -Contributors: - IBM Corporation - Initial implementation - Klaus Hartlage - www.eclipseproject.de -**********************************************************************/ - + 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 + **********************************************************************/ + +import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.List; +import net.sourceforge.phpdt.internal.compiler.util.Util; +import net.sourceforge.phpdt.internal.ui.util.PHPFileUtil; import net.sourceforge.phpeclipse.PHPeclipsePlugin; +import net.sourceforge.phpeclipse.actions.ExternalPHPParser; import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IMarker; import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IFileEditorInput; import org.eclipse.ui.texteditor.ITextEditor; import org.eclipse.ui.texteditor.TextEditorAction; -import test.PHPParserSuperclass; -import test.PHPParserManager; + +//import test.PHPParserManager; /** * ClassDeclaration that defines the action for parsing the current PHP file @@ -36,9 +39,9 @@ import test.PHPParserManager; 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); /** @@ -58,53 +61,31 @@ public class PHPParserAction extends TextEditorAction { */ public void run() { boolean phpFlag = false; - - // try { - fileToParse = getPHPFile(); - parseFile(fileToParse); + + // try { + fileToParse = getPHPFile(); + parseFile(fileToParse); + } + + public static void parseFile(IFile fileToParse) { + boolean phpFlag = false; + // try { + + if (fileToParse == null) { + // TODO should never happen => should throw an exception + System.err.println("Error : no file in the editor"); + + return; + } + String name = fileToParse.getName(); //.toLowerCase(); + + if (PHPFileUtil.isPHPFileName(name)) { + IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore(); + ExternalPHPParser parser = new ExternalPHPParser(fileToParse); + parser.phpExternalParse(); + } } - public static void parseFile(IFile fileToParse) { - boolean phpFlag = false; - try { - - if (fileToParse == null) { - // should never happen - System.err.println("Error : no file in the editor"); - // should throw an exception - return; - } - String name = fileToParse.getName().toLowerCase(); - for (int i = 0; i