void (@NotNull AbstractTreeBuilder builder, @NotNull JTree tree, @NotNull DefaultTreeModel treeModel, AbstractTreeStructure treeStructure, @Nullable Comparator<? super NodeDescriptor<?>> comparator, boolean updateIfInactive) { myBuilder = builder; myTree = tree; myTreeModel = treeModel; myActivityMonitor = UiActivityMonitor.getInstance(); myActivityId = new UiActivity.AsyncBgOperation("TreeUi " + this); addModelListenerToDiagnoseAccessOutsideEdt(); TREE_NODE_WRAPPER = AbstractTreeBuilder.createSearchingTreeNodeWrapper(); myTree.setModel(myTreeModel); setRootNode((DefaultMutableTreeNode)treeModel.getRoot()); myTreeStructure = treeStructure; myNodeDescriptorComparator = comparator; myUpdateIfInactive = updateIfInactive; UIUtil.invokeLaterIfNeeded(new TreeRunnable("AbstractTreeUi.init") { @Override public void perform() { if (!wasRootNodeInitialized()) { if (myRootNode.getChildCount() == 0) { insertLoadingNode(myRootNode, true); } } } }); myExpansionListener = new MyExpansionListener(); myTree.addTreeExpansionListener(myExpansionListener); mySelectionListener = new MySelectionListener(); myTree.addTreeSelectionListener(mySelectionListener); setUpdater(getBuilder().createUpdater()); myProgress = getBuilder().createProgressIndicator(); Disposer.register(getBuilder(), getUpdater()); if (myProgress != null) { Disposer.register(getBuilder(), () -> myProgress.cancel()); } UiNotifyConnector uiNotify = UiNotifyConnector.installOn(tree, new Activatable() { @Override public void showNotify() { myShowing = true; myWasEverShown = true; if (canInitiateNewActivity()) { activate(true); } } @Override public void hideNotify() { myShowing = false; if (canInitiateNewActivity()) { deactivate(); } } }); Disposer.register(getBuilder(), uiNotify); myTree.addFocusListener(myFocusListener); }