boolean (@NotNull Usage usage, @NotNull UsageTarget @NotNull [] targets) { if (usage instanceof PsiElementUsage) { final PsiElement psiElement = ((PsiElementUsage)usage).getElement(); if (psiElement != null) { final PsiFile containingFile = psiElement.getContainingFile(); if (containingFile instanceof GroovyFile) { // check whether the element is in the import list return PsiTreeUtil.getParentOfType(psiElement, GrImportStatement.class, true) == null; } } } return true; }