boolean (GrReferenceExpression ref) { final String text = ref.getText(); final int i = text.indexOf('<'); String className = i == -1 ? text : text.substring(0, i); PsiClass[] names = PsiShortNamesCache.getInstance(ref.getProject()).getClassesByName(className, ref.getResolveScope()); if (names.length > 0) return true; PsiFile file = ref.getContainingFile(); if (file instanceof GroovyFile) { GrImportStatement[] imports = ((GroovyFile)file).getImportStatements(); for (GrImportStatement anImport : imports) { if (className.equals(anImport.getImportedName())) return true; } } return false; }