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 **********************************************************************/ import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.List; import net.sourceforge.phpdt.internal.compiler.parser.Parser; import net.sourceforge.phpeclipse.PHPeclipsePlugin; 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; /** * Class that defines the action for parsing the current PHP file */ 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); /** * Constructs and updates the action. */ private PHPParserAction() { super(PHPEditorMessages.getResourceBundle(), "ParserAction.", null); //$NON-NLS-1$ update(); } public static PHPParserAction getInstance() { return instance; } /** * Code called when the action is fired. */ public void run() { 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