3 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
4 import org.eclipse.core.resources.IFile;
6 public class PHPParserManager {
8 private static PHPParserSuperclass parser;
10 public static PHPParserSuperclass getParser(IFile fileToParse) {
12 PHPParserSuperclass actualParser;
13 if (PHPeclipsePlugin.PHPPARSER == PHPeclipsePlugin.PHPPARSER_ORIGINAL) {
14 actualParser = (PHPParserSuperclass) Class.forName(PHPeclipsePlugin.PHPPARSER).newInstance();
17 parser = (PHPParserSuperclass) Class.forName(PHPeclipsePlugin.PHPPARSER).newInstance();
19 actualParser = parser;
21 actualParser.setFileToParse(fileToParse);
23 } catch (InstantiationException e) {
24 PHPeclipsePlugin.log(e);
25 } catch (IllegalAccessException e) {
26 PHPeclipsePlugin.log(e);
27 } catch (ClassNotFoundException e) {
28 PHPeclipsePlugin.log(e);
33 public static PHPParserSuperclass getParser() {
35 PHPParserSuperclass actualParser;
36 if (PHPeclipsePlugin.PHPPARSER == PHPeclipsePlugin.PHPPARSER_ORIGINAL) {
37 actualParser = (PHPParserSuperclass) Class.forName(PHPeclipsePlugin.PHPPARSER).newInstance();
40 parser = (PHPParserSuperclass) Class.forName(PHPeclipsePlugin.PHPPARSER).newInstance();
42 actualParser = parser;
45 } catch (InstantiationException e) {
46 PHPeclipsePlugin.log(e);
47 } catch (IllegalAccessException e) {
48 PHPeclipsePlugin.log(e);
49 } catch (ClassNotFoundException e) {
50 PHPeclipsePlugin.log(e);
56 * To avoid instantiation.
58 private PHPParserManager() {