JComponent () { ProjectAbstractTreeStructureBase treeStructure = new AbstractProjectTreeStructure(myProject) { @Override public boolean isShowMembers() { return myIsShowMembers; } @Override public boolean isHideEmptyMiddlePackages() { return true; } @Override public boolean isShowLibraryContents() { return myIsShowLibraryContents; } @Override public boolean isShowModules() { return false; } }; myModel = new StructureTreeModel<>(treeStructure, getDisposable()); myModel.setComparator(AlphaComparator.INSTANCE); myTree = new Tree(new AsyncTreeModel(myModel, getDisposable())); myTree.setRootVisible(false); myTree.setShowsRootHandles(true); myTree.expandRow(0); myTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); myTree.setCellRenderer(new NodeRenderer()); JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTree); scrollPane.setPreferredSize(JBUI.size(500, 300)); scrollPane.putClientProperty(UIUtil.KEEP_BORDER_SIDES, SideBorder.RIGHT | SideBorder.LEFT | SideBorder.BOTTOM); myTree.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (KeyEvent.VK_ENTER == e.getKeyCode()) { doOKAction(); } } }); new DoubleClickListener() { @Override protected boolean onDoubleClick(@NotNull MouseEvent event) { TreePath path = myTree.getPathForLocation(event.getX(), event.getY()); if (path != null && myTree.isPathSelected(path)) { doOKAction(); return true; } return false; } }.installOn(myTree); myTree.addTreeSelectionListener(__ -> handleSelectionChanged()); TreeUIHelper.getInstance().installTreeSpeedSearch(myTree); myTabbedPane = new TabbedPaneWrapper(getDisposable()); final JPanel dummyPanel = new JPanel(new BorderLayout()); myGotoByNamePanel = new ChooseByNamePanel(myProject, createChooseByNameModel(), null, myScope.isSearchInLibraries(), getContext()) { @Override protected void showTextFieldPanel() { } @Override protected void close(boolean isOk) { super.close(isOk); if (isOk) { doOKAction(); } else { doCancelAction(); } } @Override protected @NotNull Set<Object> filter(@NotNull Set<Object> elements) { return doFilter(elements); } @Override protected void initUI(ChooseByNamePopupComponent.Callback callback, ModalityState modalityState, boolean allowMultipleSelection) { super.initUI(callback, modalityState, allowMultipleSelection); dummyPanel.add(myGotoByNamePanel.getPanel(), BorderLayout.CENTER); if (myProject != null && !myProject.isDefault() && DumbService.getInstance(myProject).isDumb()) { JBLabel dumbLabel = new JBLabel(IdeBundle.message("dumb.mode.results.might.be.incomplete"), SwingConstants.LEFT); dumbLabel.setIcon(AllIcons.General.Warning); dumbLabel.setBorder(new JBEmptyBorder(10, 3, 0, 3)); dummyPanel.add(dumbLabel, BorderLayout.SOUTH); } IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> IdeFocusManager.getGlobalInstance() .requestFocus(IdeFocusTraversalPolicy.getPreferredFocusedComponent(myGotoByNamePanel.getPanel()), true)); } @Override protected void showList() { super.showList(); if (myInitialClass != null && myList.getModel().getSize() > 0) { myList.setSelectedValue(myInitialClass, true); myInitialClass = null; } } @Override protected void chosenElementMightChange() { handleSelectionChanged(); } }; Disposer.register(myDisposable, myGotoByNamePanel); myTabbedPane.addTab(IdeBundle.message("tab.chooser.search.by.name"), dummyPanel); myTabbedPane.addTab(IdeBundle.message("tab.chooser.project"), scrollPane); myGotoByNamePanel.invoke(new MyCallback(), getModalityState(), false); myTabbedPane.addChangeListener(__ -> handleSelectionChanged()); return myTabbedPane.getComponent(); }