JComponent () { myModel = new StructureTreeModel<>(new MyStructure(getProject()), WeightBasedComparator.FULL_INSTANCE, myDisposable); myTree.setModel(new AsyncTreeModel(myModel, myDisposable)); myTree.setDragEnabled(false); myTree.setShowsRootHandles(true); myTree.setRootVisible(false); myTree.addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(final TreeSelectionEvent e) { updateOKAction(); } }); new DoubleClickListener() { @Override protected boolean onDoubleClick(@NotNull MouseEvent e) { if (isOKActionEnabled()) { doOKAction(); return true; } return false; } }.installOn(myTree); myTree.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "ENTER"); myTree.getActionMap().put("ENTER", getOKAction()); final JScrollPane pane = ScrollPaneFactory.createScrollPane(myTree); pane.setPreferredSize(JBUI.size(500, 400)); return pane; }