boolean (@NotNull PsiElement element) { if (!(element instanceof PsiImportStatementBase importStatement)) { return false; } if (!importStatement.isOnDemand() || ErrorUtil.containsError(element)) { return false; } if (importStatement instanceof PsiImportStaticStatement && ((PsiImportStaticStatement)importStatement).resolveTargetClass() == null) { return false; } return importStatement.getContainingFile() instanceof PsiJavaFile; }