private void applySelectedTo(@NotNull JTree tree) {
    List<TreePath> selection = new ArrayList<>();
    for (PathElement[] path : mySelectedPaths) {
      TreeModel model = tree.getModel();
      TreePath treePath = new CachingTreePath(model.getRoot());
      for (int i = 1; treePath != null && i < path.length; i++) {
        treePath = findMatchedChild(model, treePath, path[i]);
      }
      ContainerUtil.addIfNotNull(selection, treePath);
    }
    if (selection.isEmpty()) return;
    tree.setSelectionPaths(selection.toArray(TreeUtil.EMPTY_TREE_PATH));
    if (myScrollToSelection) {
      TreeUtil.showRowCentered(tree, tree.getRowForPath(selection.get(0)), true, true);
    }
  }
private void applySelectedTo(@NotNull JTree tree)