public static boolean hasImportStatic(String fqClassName,String memberName,PsiElement context){
  final PsiFile file=context.getContainingFile();
  if (!(file instanceof PsiJavaFile)) {
    return false;
  }
  final PsiJavaFile javaFile=(PsiJavaFile)file;
  final PsiImportList importList=javaFile.getImportList();
  if (importList == null) {
    return false;
  }
  final PsiImportStaticStatement[] importStaticStatements=importList.getImportStaticStatements();
  for (  PsiImportStaticStatement importStaticStatement : importStaticStatements) {
    if (importStaticStatement.isOnDemand()) {
      PsiClass psiClass=ClassUtils.findClass(fqClassName,context);
      if (psiClass != null && psiClass.equals(importStaticStatement.resolveTargetClass())) {
        return true;
      }
      continue;
    }
    final String name=importStaticStatement.getReferenceName();
    if (!memberName.equals(name)) {
      continue;
    }
    final PsiJavaCodeReferenceElement importReference=importStaticStatement.getImportReference();
    if (importReference == null) {
      continue;
    }
    final PsiElement qualifier=importReference.getQualifier();
    if (qualifier == null) {
      continue;
    }
    final String qualifierText=qualifier.getText();
    if (fqClassName.equals(qualifierText)) {
      return true;
    }
  }
  return false;
}

public static boolean hasImportStatic ( String fqClassName , String memberName , PsiElement context ) { final PsiFile file = context . getContainingFile ( ) ; if ( ! ( file instanceof PsiJavaFile ) ) { return false ; } final PsiJavaFile javaFile = ( PsiJavaFile ) file ; final PsiImportList importList = javaFile . getImportList ( ) ; if ( importList == null ) { return false ; } final PsiImportStaticStatement [ ] importStaticStatements = importList . getImportStaticStatements ( ) ; for ( PsiImportStaticStatement importStaticStatement : importStaticStatements ) { if ( importStaticStatement . isOnDemand ( ) ) { PsiClass psiClass = ClassUtils . findClass ( fqClassName , context ) ; if ( psiClass != null && psiClass . equals ( importStaticStatement . resolveTargetClass ( ) ) ) { return true ; } continue ; } final String name = importStaticStatement . getReferenceName ( ) ; if ( ! memberName . equals ( name ) ) { continue ; } final PsiJavaCodeReferenceElement importReference = importStaticStatement . getImportReference ( ) ; if ( importReference == null ) { continue ; } final PsiElement qualifier = importReference . getQualifier ( ) ; if ( qualifier == null ) { continue ; } final String qualifierText = qualifier . getText ( ) ; if ( fqClassName . equals ( qualifierText ) ) { return true ; } } return false ; }
check whether the current context has a static member import , either on - demand or explicit .
