JComponent () { ProjectAbstractTreeStructureBase treeStructure = new AbstractProjectTreeStructure(myProject) { @Override public boolean isHideEmptyMiddlePackages() { return true; } @Override public Object @NotNull [] getChildElements(final @NotNull Object element) { return filterFiles(super.getChildElements(element)); } @Override public boolean isShowLibraryContents() { return myShowLibraryContents; } @Override public boolean isShowModules() { return false; } @Override public List<TreeStructureProvider> getProviders() { return myDisableStructureProviders ? null : super.getProviders(); } }; myModel = new StructureTreeModel<>(treeStructure, getDisposable()); myModel.setComparator(AlphaComparator.INSTANCE); myTree = new Tree(new AsyncTreeModel(myModel, getDisposable())); myTree.setRootVisible(false); myTree.expandRow(0); myTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); myTree.setCellRenderer(new NodeRenderer()); final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTree); scrollPane.setPreferredSize(JBUI.size(500, 300)); myTree.addKeyListener(new KeyAdapter() { @Override public void keyPressed(final KeyEvent e) { if (KeyEvent.VK_ENTER == e.getKeyCode()) { doOKAction(); } } }); new DoubleClickListener() { @Override protected boolean onDoubleClick(@NotNull MouseEvent e) { final TreePath path = myTree.getPathForLocation(e.getX(), e.getY()); if (path != null && myTree.isPathSelected(path)) { doOKAction(); return true; } return false; } }.installOn(myTree); myTree.addTreeSelectionListener( new TreeSelectionListener() { @Override public void valueChanged(final TreeSelectionEvent e) { handleSelectionChanged(); } } ); TreeUIHelper.getInstance().installTreeSpeedSearch(myTree); myTabbedPane = new TabbedPaneWrapper(getDisposable()); final JPanel dummyPanel = new JPanel(new BorderLayout()); String name = null; if (myInitialFile != null) { name = myInitialFile.getName(); } myGotoByNamePanel = new ChooseByNamePanel(myProject, new MyGotoFileModel(), name, true, myInitialFile) { @Override protected void close(final boolean isOk) { super.close(isOk); if (isOk) { doOKAction(); } else { doCancelAction(); } } @Override protected void initUI(final ChooseByNamePopupComponent.Callback callback, final ModalityState modalityState, boolean allowMultipleSelection) { super.initUI(callback, modalityState, allowMultipleSelection); dummyPanel.add(myGotoByNamePanel.getPanel(), BorderLayout.CENTER); //IdeFocusTraversalPolicy.getPreferredFocusedComponent(myGotoByNamePanel.getPanel()).requestFocus(); if (mySelectSearchByNameTab) { myTabbedPane.setSelectedIndex(1); } } @Override protected void showTextFieldPanel() { } @Override protected void chosenElementMightChange() { handleSelectionChanged(); } }; myTabbedPane.addTab(IdeBundle.message("tab.chooser.project"), scrollPane); myTabbedPane.addTab(IdeBundle.message("tab.chooser.search.by.name"), dummyPanel); SwingUtilities.invokeLater(() -> myGotoByNamePanel.invoke(new MyCallback(), ModalityState.stateForComponent(getRootPane()), false)); myTabbedPane.addChangeListener( new ChangeListener() { @Override public void stateChanged(final ChangeEvent e) { handleSelectionChanged(); } } ); return myTabbedPane.getComponent(); }