JPanel () { final JPanel panel = new JPanel(new BorderLayout()); DefaultActionGroup group = new DefaultActionGroup(); final ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("ChooseActionsDialog", group, true); toolbar.setTargetComponent(myActionsTree.getTree()); final CommonActionsManager commonActionsManager = CommonActionsManager.getInstance(); final TreeExpander treeExpander = KeymapPanel.createTreeExpander(myActionsTree); group.add(commonActionsManager.createExpandAllAction(treeExpander, myActionsTree.getTree())); group.add(commonActionsManager.createCollapseAllAction(treeExpander, myActionsTree.getTree())); panel.add(toolbar.getComponent(), BorderLayout.WEST); group = new DefaultActionGroup(); ActionToolbar actionToolbar = ActionManager.getInstance().createActionToolbar("ChooseActionsDialog", group, true); actionToolbar.setTargetComponent(myActionsTree.getTree()); actionToolbar.setReservePlaceAutoPopupIcon(false); final JComponent searchToolbar = actionToolbar.getComponent(); final Alarm alarm = new Alarm(); myFilterComponent = new FilterComponent("KEYMAP_IN_QUICK_LISTS", 5) { @Override public void filter() { alarm.cancelAllRequests(); alarm.addRequest(() -> { if (!myFilterComponent.isShowing()) return; if (!myTreeExpansionMonitor.isFreeze()) myTreeExpansionMonitor.freeze(); myFilteringPanel.setShortcut(null); final String filter = getFilter(); myActionsTree.filter(filter, myQuicklists); final JTree tree = myActionsTree.getTree(); TreeUtil.expandAll(tree); if (filter == null || filter.length() == 0) { TreeUtil.collapseAll(tree, 0); myTreeExpansionMonitor.restore(); } }, 300); } }; myFilterComponent.reset(); panel.add(myFilterComponent, BorderLayout.CENTER); group.add(new AnAction(KeyMapBundle.message("filter.shortcut.action.text"), KeyMapBundle.message("filter.shortcut.action.description"), AllIcons.Actions.ShortcutFilter) { @Override public void actionPerformed(@NotNull AnActionEvent e) { myFilterComponent.reset(); myActionsTree.reset(myKeymap, myQuicklists); myFilteringPanel.showPopup(searchToolbar, e.getInputEvent().getComponent()); } }); group.add(new AnAction(KeyMapBundle.message("filter.clear.action.text"), KeyMapBundle.message("filter.shortcut.action.description"), AllIcons.Actions.GC) { @Override public void update(@NotNull AnActionEvent event) { boolean enabled = null != myFilteringPanel.getShortcut(); Presentation presentation = event.getPresentation(); presentation.setEnabled(enabled); presentation.setIcon(enabled ? AllIcons.Actions.Cancel : EmptyIcon.ICON_16); } @Override public @NotNull ActionUpdateThread getActionUpdateThread() { return ActionUpdateThread.BGT; } @Override public void actionPerformed(@NotNull AnActionEvent e) { myFilteringPanel.setShortcut(null); myActionsTree.filter(null, myQuicklists); //clear filtering TreeUtil.collapseAll(myActionsTree.getTree(), 0); myTreeExpansionMonitor.restore(); } }); panel.add(searchToolbar, BorderLayout.EAST); return panel; }