private static @Nullable List<AnAction> findAllTouchbarActions(@NotNull Component root) {
    List<AnAction> result = null;
    // by default used TreeTraversal.PRE_ORDER_DFS: each node's subtrees are traversed after the node itself is returned.
    final JBIterable<Component> iter = UIUtil.uiTraverser(root).expandAndFilter(c -> c.isVisible()).traverse();
    for (Component component : iter) {
      if (component instanceof JComponent) {
        final ActionGroup group = Touchbar.getActions((JComponent)component);
        if (group != null) {
          if (result == null) {
            result = new ArrayList<>();
          }
          result.add(group);
        }
      }
    }

    return result;
  }
private static @Nullable List<AnAction> findAllTouchbarActions(@NotNull Component root)