public static List<PsiImportStatementBase> getPotentialImports(@NotNull PsiJavaCodeReferenceElement ref) {
    PsiElement parent = ref.getParent();
    if (parent instanceof PsiImportStatementBase || ref.isQualified()) return Collections.emptyList();
    boolean maybeClass = canBeClass(ref);
    if (!(ref.getContainingFile() instanceof PsiJavaFile)) return Collections.emptyList();
    PsiImportList list = ((PsiJavaFile)ref.getContainingFile()).getImportList();
    List<PsiImportStatementBase> imports = new ArrayList<>();
    if (list != null) {
      for (PsiImportStatementBase statement : list.getAllImportStatements()) {
        if (statement instanceof PsiImportStaticStatement && ((PsiImportStaticStatement)statement).resolveTargetClass() != null) continue;
        if (!statement.isOnDemand()) {
          PsiJavaCodeReferenceElement reference = statement.getImportReference();
          if (reference == null) continue;
          String name = reference.getReferenceName();
          if (name == null || !name.equals(ref.getReferenceName())) continue;
          if (reference.resolve() != null) continue;
        }
        // Unqualified method call cannot be imported using non-static import
        if (maybeClass || statement instanceof PsiImportStaticStatement) {
          imports.add(statement);
        }
      }
    }
    return imports;
  }
public static List<PsiImportStatementBase> getPotentialImports(@NotNull PsiJavaCodeReferenceElement ref)