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