JTree () { DefaultMutableTreeNode root = new DefaultMutableTreeNode(); final Tree tree = new Tree(new DefaultTreeModel(root))/* { @Override protected void paintComponent(Graphics g) { DuplicateNodeRenderer.paintDuplicateNodesBackground(g, this); super.paintComponent(g); } }*/; tree.setOpaque(false); tree.setToggleClickCount(-1); tree.setCellRenderer(new MultiLanguageTreeCellRenderer(myProvider.getRenderer())); tree.setRootVisible(false); tree.setShowsRootHandles(true); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); tree.setSelectionPath(new TreePath(root.getPath())); EditSourceOnDoubleClickHandler.install(tree); TreeUIHelper.getInstance().installTreeSpeedSearch(tree); TreeUtil.installActions(tree); ToolTipManager.sharedInstance().registerComponent(tree); myAutoScrollToSourceHandler.install(tree); tree.getSelectionModel().addTreeSelectionListener(e -> treeSelectionChanged()); tree.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (KeyEvent.VK_ENTER == e.getKeyCode()) { List<Navigatable> navigatables = getNavigatables(); if (navigatables.isEmpty()) return; for (Navigatable navigatable : navigatables) { if (navigatable instanceof AbstractTreeNode && ((AbstractTreeNode<?>)navigatable).getValue() instanceof Usage) { navigatable = (Usage)((AbstractTreeNode<?>)navigatable).getValue(); } if (navigatable.canNavigateToSource()) { navigatable.navigate(false); if (navigatable instanceof Usage) { ((Usage)navigatable).highlightInEditor(); } } } e.consume(); } } }); tree.addTreeWillExpandListener(new TreeWillExpandListener() { @Override public void treeWillCollapse(TreeExpansionEvent event) { } @Override public void treeWillExpand(TreeExpansionEvent event) { TreePath path = event.getPath(); SliceNode node = fromPath(path); if (node != null) { node.calculateDupNode(); } } }); return tree; }