private static boolean isGeneralizedAncestor(@NotNull Component ancestor, @NotNull Component descendant) {
    do {
      if (descendant == ancestor) {
        return true;
      }
      descendant = getParent(descendant);
    }
    while (descendant != null);
    return false;
  }
private static boolean isGeneralizedAncestor(@NotNull Component ancestor, @NotNull Component descendant)