void (PsiFile file, int startOffset, PsiElement element, ArrayList<ReferenceData> to) { if (DumbService.isDumb(element.getProject())) { // IDEA-284298 return; } if (element instanceof GrReferenceElement) { if (((GrReferenceElement<?>)element).getQualifier() == null) { final GroovyResolveResult resolveResult = ((GrReferenceElement<?>)element).advancedResolve(); final PsiElement refElement = resolveResult.getElement(); if (refElement != null) { if (refElement instanceof PsiClass) { if (refElement.getContainingFile() != element.getContainingFile()) { final String qName = ((PsiClass)refElement).getQualifiedName(); if (qName != null) { addReferenceData(element, to, startOffset, qName, null); } } } else if (resolveResult.getCurrentFileResolveContext() instanceof GrImportStatement && ((GrImportStatement)resolveResult.getCurrentFileResolveContext()).isStatic()) { final String classQName = ((PsiMember)refElement).getContainingClass().getQualifiedName(); final String name = ((PsiNamedElement)refElement).getName(); if (classQName != null && name != null) { addReferenceData(element, to, startOffset, classQName, name); } } } } } }