private static Pair<PsiClass, Integer> getTopOrStaticEnclosingClass(PsiClass aClass) {
    int depth = 0;
    PsiClass enclosing = PsiUtil.getContainingClass(aClass);
    while (enclosing != null) {
      depth++;
      if (enclosing.hasModifierProperty(PsiModifier.STATIC)) {
        break;
      }
      PsiClass next = PsiUtil.getContainingClass(enclosing);
      if (next == null) {
        break;
      }
      enclosing = next;
    }
    return Pair.create(enclosing, depth);
  }
private static Pair<PsiClass, Integer> getTopOrStaticEnclosingClass(PsiClass aClass)