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,
 
  17                         List includesList, char[] ident) {
 
  18                 String identStr = new String(ident);
 
  21                 for (int i = 0; i < includesList.size(); i++) {
 
  22                         ir = (ImportReference) includesList.get(i);
 
  25                                 ICompilationUnit unit = JavaCore
 
  26                                                 .createCompilationUnitFrom(file);
 
  29                                                 // TODO avoid recursion here. Sometimes we get a
 
  30                                                 // java.lang.StackOverflowError
 
  31                                                 IType[] types = unit.getAllTypes();
 
  33                                                         for (int j = 0; j < types.length; j++) {
 
  34                                                                 if (types[j].getElementName().equals(identStr)) {
 
  35                                                                         return new SingleTypeReference(
 
  39                                                                                                         .getCurrentTokenStartPosition(),
 
  41                                                                                                         .getCurrentTokenEndPosition());
 
  45                                         } catch (JavaModelException e) {