void (AnActionButton button) { AttachFilesAction attachFilesAction = new AttachFilesAction(myDescriptor.getAttachFilesActionName()); if (popupItems.isEmpty()) { attachFilesAction.perform(); return; } List<AnAction> actions = new ArrayList<>(); actions.add(attachFilesAction); for (AttachRootButtonDescriptor descriptor : popupItems) { actions.add(new AttachItemAction(descriptor, descriptor.getButtonText(), null)); } final DefaultActionGroup group = new DefaultActionGroup(actions); JBPopupFactory.getInstance().createActionGroupPopup(null, group, DataManager.getInstance().getDataContext(button.getContextComponent()), JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, true) .show(button.getPreferredPopupPoint()); }