private Tree createTree(DefaultTreeModel model) {
    Tree tree = new Tree(model);
    tree.setShowsRootHandles(true);
    tree.setRootVisible(false);
    tree.setCellRenderer(new PreviewTreeRenderer());
    @NonNls String treeName = "ExtractMethodPreview";
    tree.setName(treeName);
    tree.getSelectionModel().addTreeSelectionListener(
      e -> ApplicationManager.getApplication().invokeLater(
        () -> onSelectionUpdate()));

    SmartExpander.installOn(tree);
    TreeUtil.installActions(tree);
    TreeUtil.expand(tree, 2);
    TreeUtil.promiseSelectFirst(tree);

    PopupHandler.installPopupMenu(tree, IdeActions.EXTRACT_METHOD_TOOL_WINDOW_TREE_POPUP, "ExtractMethodTreePopup");
    return tree;
  }
private Tree createTree(DefaultTreeModel model)