private boolean isLeaf(TreePath path) {
    Object component = path.getLastPathComponent();
    if (component instanceof DefaultMutableTreeNode node) {
      return node.isLeaf();
    }
    return myAsyncTreeModel.isLeaf(component);
  }
private boolean isLeaf(TreePath path)