3 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
5 import org.eclipse.core.resources.IFile;
7 public class PHPParserManager {
9 private static PHPParserSuperclass parser;
11 public static PHPParserSuperclass getParser(IFile fileToParse) {
13 PHPParserSuperclass actualParser;
14 if (PHPeclipsePlugin.PHPPARSER == PHPeclipsePlugin.PHPPARSER_ORIGINAL) {
15 actualParser = (PHPParserSuperclass) Class.forName(PHPeclipsePlugin.PHPPARSER).newInstance();
18 parser = (PHPParserSuperclass) Class.forName(PHPeclipsePlugin.PHPPARSER).newInstance();
20 actualParser = parser;
22 actualParser.setFileToParse(fileToParse);
24 } catch (InstantiationException e) {
25 PHPeclipsePlugin.log(e);
26 } catch (IllegalAccessException e) {
27 PHPeclipsePlugin.log(e);
28 } catch (ClassNotFoundException e) {
29 PHPeclipsePlugin.log(e);
34 public static PHPParserSuperclass getParser() {
36 PHPParserSuperclass actualParser;
37 if (PHPeclipsePlugin.PHPPARSER == PHPeclipsePlugin.PHPPARSER_ORIGINAL) {
38 actualParser = (PHPParserSuperclass) Class.forName(PHPeclipsePlugin.PHPPARSER).newInstance();
41 parser = (PHPParserSuperclass) Class.forName(PHPeclipsePlugin.PHPPARSER).newInstance();
43 actualParser = parser;
46 } catch (InstantiationException e) {
47 PHPeclipsePlugin.log(e);
48 } catch (IllegalAccessException e) {
49 PHPeclipsePlugin.log(e);
50 } catch (ClassNotFoundException e) {
51 PHPeclipsePlugin.log(e);
57 * To avoid instantiation.
59 private PHPParserManager() {