void (@Nullable Object value) { Runnable finish = () -> { hookSelection(); fireSelectionChanged(); }; unhookSelection(); myTreeModel.invalidateAsync().thenRun(() -> { if (value == null) { myTree.clearSelection(); finish.run(); } else if (value instanceof RadComponent) { myTreeModel.select(value, myTree, path -> finish.run()); } else { List<TreePath> selection = new ArrayList<>(); for (Object element : (Collection)value) { if (element instanceof RadComponent component) { TreePath path = getPath(component); if (path != null) { selection.add(path); } } } if (selection.isEmpty()) { myTree.clearSelection(); } else { TreeUtil.selectPaths(myTree, selection); } finish.run(); } }); }