private static boolean isLoadingChildrenFor(Object nodeObject) {
    if (!(nodeObject instanceof DefaultMutableTreeNode node)) return false;
    int loadingNodes = 0;
    for (int i = 0; i < Math.min(node.getChildCount(), 2); i++) {
      TreeNode child = node.getChildAt(i);
      if (child instanceof LoadingNode) {
        loadingNodes++;
      }
    }
    return loadingNodes > 0 && loadingNodes == node.getChildCount();
  }
private static boolean isLoadingChildrenFor(Object nodeObject)