JComponent () { List<FileStructureFilter> fileStructureFilters = new ArrayList<>(); List<FileStructureNodeProvider> fileStructureNodeProviders = new ArrayList<>(); if (myTreeActionsOwner != null) { for (Filter filter : myTreeModel.getFilters()) { if (filter instanceof FileStructureFilter fsFilter) { myTreeActionsOwner.setActionIncluded(fsFilter, true); fileStructureFilters.add(fsFilter); } } if (myTreeModel instanceof ProvidingTreeModel) { for (NodeProvider provider : ((ProvidingTreeModel)myTreeModel).getNodeProviders()) { if (provider instanceof FileStructureNodeProvider) { fileStructureNodeProviders.add((FileStructureNodeProvider)provider); } } } } int checkBoxCount = fileStructureNodeProviders.size() + fileStructureFilters.size(); JPanel panel = new JPanel(new BorderLayout()); panel.setPreferredSize(JBUI.size(540, 500)); JPanel chkPanel = new JPanel(new GridLayout(0, checkBoxCount > 0 && checkBoxCount % 4 == 0 ? checkBoxCount / 2 : 3, JBUIScale.scale(UIUtil.DEFAULT_HGAP), 0)); chkPanel.setOpaque(false); Shortcut[] F4 = ActionManager.getInstance().getAction(IdeActions.ACTION_EDIT_SOURCE).getShortcutSet().getShortcuts(); Shortcut[] ENTER = CustomShortcutSet.fromString("ENTER").getShortcuts(); CustomShortcutSet shortcutSet = new CustomShortcutSet(ArrayUtil.mergeArrays(F4, ENTER)); new NavigateSelectedElementAction(panel).registerCustomShortcutSet(shortcutSet, panel); DumbAwareAction.create(e -> { if (mySpeedSearch != null && mySpeedSearch.isPopupActive()) { mySpeedSearch.hidePopup(); } else { myPopup.cancel(); } }).registerCustomShortcutSet(CustomShortcutSet.fromString("ESCAPE"), myTree); new ClickListener() { @Override public boolean onClick(@NotNull MouseEvent e, int clickCount) { TreePath path = myTree.getClosestPathForLocation(e.getX(), e.getY()); Rectangle bounds = path == null ? null : myTree.getPathBounds(path); if (bounds == null || bounds.x > e.getX() || bounds.y > e.getY() || bounds.y + bounds.height < e.getY()) return false; navigateSelectedElement(); return true; } }.installOn(myTree); for (FileStructureFilter filter : fileStructureFilters) { addCheckbox(chkPanel, filter); } for (FileStructureNodeProvider provider : fileStructureNodeProviders) { addCheckbox(chkPanel, provider); } JPanel topPanel = new JPanel(new BorderLayout()); topPanel.add(chkPanel, BorderLayout.WEST); topPanel.add(createSettingsButton(), BorderLayout.EAST); topPanel.setBackground(JBUI.CurrentTheme.Popup.toolbarPanelColor()); Dimension prefSize = topPanel.getPreferredSize(); prefSize.height = JBUI.CurrentTheme.Popup.toolbarHeight(); topPanel.setPreferredSize(prefSize); topPanel.setBorder(JBUI.Borders.emptyLeft(UIUtil.DEFAULT_HGAP)); panel.add(topPanel, BorderLayout.NORTH); JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTree); scrollPane.setBorder(IdeBorderFactory.createBorder(JBUI.CurrentTheme.Popup.toolbarBorderColor(), SideBorder.TOP | SideBorder.BOTTOM)); panel.add(scrollPane, BorderLayout.CENTER); DataManager.registerDataProvider(panel, this::getData); panel.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { myPopup.cancel(); } }); return panel; }