@Nullable
  public static PsiClass getContainingClass(PsiElement element) {
    PsiClass currentClass;
    while (true) {
      currentClass = PsiTreeUtil.getParentOfType(element, PsiClass.class);
      if (currentClass instanceof PsiAnonymousClass &&
          PsiTreeUtil.isAncestor(((PsiAnonymousClass)currentClass).getArgumentList(), element, false)) {
        element = currentClass;
      } else {
        return currentClass;
      }
    }
  }
@Nullable
  public static PsiClass getContainingClass(PsiElement element)