1 package net.sourceforge.phpdt.internal.compiler.parser;
5 import net.sourceforge.phpdt.core.ICompilationUnit;
6 import net.sourceforge.phpdt.core.IType;
7 import net.sourceforge.phpdt.core.JavaCore;
8 import net.sourceforge.phpdt.core.JavaModelException;
9 import net.sourceforge.phpdt.internal.compiler.ast.ImportReference;
10 import net.sourceforge.phpdt.internal.compiler.ast.SingleTypeReference;
12 import org.eclipse.core.resources.IFile;
14 public class ParserUtil {
16 public static SingleTypeReference getTypeReference(Scanner scanner, List includesList, char[] ident) {
17 String identStr = new String(ident);
20 for (int i = 0; i < includesList.size(); i++) {
21 ir = (ImportReference) includesList.get(i);
24 ICompilationUnit unit = JavaCore.createCompilationUnitFrom(file);
27 // TODO avoid recursion here. Sometimes we get a java.lang.StackOverflowError
28 IType[] types = unit.getAllTypes();
30 for (int j = 0; j < types.length; j++) {
31 if (types[j].getElementName().equals(identStr)) {
32 return new SingleTypeReference(file, ident, scanner.getCurrentTokenStartPosition(), scanner
33 .getCurrentTokenEndPosition());
37 } catch (JavaModelException e) {