package test; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import org.eclipse.core.resources.IFile; public class PHPParserManager { public static PHPParserSuperclass getParser(IFile fileToParse) { try { PHPParserSuperclass actualParser; if (PHPeclipsePlugin.PHPPARSER == PHPeclipsePlugin.PHPPARSER_ORIGINAL) { actualParser = (PHPParserSuperclass) Class.forName(PHPeclipsePlugin.PHPPARSER).newInstance(); } else { actualParser = (PHPParserSuperclass) Class.forName(PHPeclipsePlugin.PHPPARSER).newInstance(); } actualParser.setFileToParse(fileToParse); return actualParser; } catch (InstantiationException e) { PHPeclipsePlugin.log(e); } catch (IllegalAccessException e) { PHPeclipsePlugin.log(e); } catch (ClassNotFoundException e) { PHPeclipsePlugin.log(e); } return null; } public static PHPParserSuperclass getParser() { try { PHPParserSuperclass actualParser; if (PHPeclipsePlugin.PHPPARSER == PHPeclipsePlugin.PHPPARSER_ORIGINAL) { actualParser = (PHPParserSuperclass) Class.forName(PHPeclipsePlugin.PHPPARSER).newInstance(); } else { actualParser = (PHPParserSuperclass) Class.forName(PHPeclipsePlugin.PHPPARSER).newInstance(); } return actualParser; } catch (InstantiationException e) { PHPeclipsePlugin.log(e); } catch (IllegalAccessException e) { PHPeclipsePlugin.log(e); } catch (ClassNotFoundException e) { PHPeclipsePlugin.log(e); } return null; } /** * To avoid instantiation. */ private PHPParserManager() { } }