private static boolean checkNonQualified(PsiModifierListOwner member,
                                           PsiElement place,
                                           PsiElement resolveContext,
                                           PsiClass containingClass) {
    if (containingClass == null) return true;
    if (member instanceof GrVariable && !(member instanceof GrField)) return true;
    if (member.hasModifierProperty(PsiModifier.STATIC)) return true;
    if (CommonClassNames.JAVA_LANG_OBJECT.equals(containingClass.getQualifiedName())) return true;

    if (resolveContext != null) {
      PsiElement stopAt = PsiTreeUtil.findCommonParent(place, resolveContext);
      while (place != null && place != stopAt && !(place instanceof GrMember)) {
        if (place instanceof PsiFile) break;
        if (place instanceof GrClosableBlock) return true;
        place = place.getParent();
      }
      if (place == null || place instanceof PsiFile || place == stopAt) return true;
      if (place instanceof GrTypeDefinition) {
        return !(((GrTypeDefinition)place).hasModifierProperty(PsiModifier.STATIC) ||
                 ((GrTypeDefinition)place).getContainingClass() == null);
      }
      return !((GrMember)place).hasModifierProperty(PsiModifier.STATIC);
    }
    else {
      while (place != null) {
        place = place.getParent();
        if (place instanceof PsiClass && InheritanceUtil.isInheritorOrSelf((PsiClass)place, containingClass, true)) return true;
        if (place instanceof GrClosableBlock) return true;
        if (place instanceof PsiMember && ((PsiMember)place).hasModifierProperty(PsiModifier.STATIC)) {
          return false;
        }
      }
      return true;
    }
  }
private static boolean checkNonQualified(PsiModifierListOwner member,
                                           PsiElement place,
                                           PsiElement resolveContext,
                                           PsiClass containingClass)