JComponent () { final ClasspathPanelAction removeAction = new ClasspathPanelAction(this) { @Override public void run() { removeSelectedItems(TableUtil.removeSelectedItems(myEntryTable)); } }; final ToolbarDecorator decorator = ToolbarDecorator.createDecorator(myEntryTable); AnActionButtonUpdater moveUpDownUpdater = e -> { for (RowSorter.SortKey key : myEntryTable.getRowSorter().getSortKeys()) { if (key.getSortOrder() != SortOrder.UNSORTED) { return false; } } return true; }; decorator.setAddAction(new AnActionButtonRunnable() { @Override public void run(AnActionButton button) { initPopupActions(); final JBPopup popup = JBPopupFactory.getInstance().createListPopup( new BaseListPopupStep<>(null, myPopupActions) { @Override public Icon getIconFor(AddItemPopupAction<?> aValue) { return aValue.getIcon(); } @Override public boolean hasSubstep(AddItemPopupAction<?> selectedValue) { return selectedValue.hasSubStep(); } @Override public boolean isMnemonicsNavigationEnabled() { return true; } @Override public PopupStep onChosen(final AddItemPopupAction<?> selectedValue, final boolean finalChoice) { if (selectedValue.hasSubStep()) { return selectedValue.createSubStep(); } return doFinalStep(() -> selectedValue.execute()); } @Override @NotNull public String getTextFor(AddItemPopupAction<?> value) { return "&" + value.getIndex() + " " + value.getTitle(); } }); final RelativePoint point = button.getPreferredPopupPoint(); popup.show(point); } }) .setRemoveAction(new AnActionButtonRunnable() { @Override public void run(AnActionButton button) { removeAction.actionPerformed(null); } }) .setRemoveActionUpdater(e -> { final int[] selectedRows = myEntryTable.getSelectedRows(); for (final int selectedRow : selectedRows) { if (!getItemAt(selectedRow).isRemovable()) { return false; } } return selectedRows.length > 0; }) .setMoveUpAction(new AnActionButtonRunnable() { @Override public void run(AnActionButton button) { moveSelectedRows(-1); } }) .setMoveUpActionUpdater(moveUpDownUpdater) .setMoveUpActionName(JavaUiBundle.message("action.text.class.path.move.up")) .setMoveDownAction(new AnActionButtonRunnable() { @Override public void run(AnActionButton button) { moveSelectedRows(+1); } }) .setMoveDownActionUpdater(moveUpDownUpdater) .setMoveDownActionName(JavaUiBundle.message("action.text.class.path.move.down")) .addExtraAction(myEditButton); final JPanel panel = decorator.createPanel(); myRemoveButton = ToolbarDecorator.findRemoveButton(panel); return panel; }