DefaultActionGroup (@NotNull JComponent button, @NotNull DataContext context) { DefaultActionGroup actionGroup = new DefaultActionGroup(); for (final FixableMessageInfo message : myItems) { AnAction action; if ((message.myQuickFix != null && (message.myLinkText.length() > 0 || message.myAfterLinkText.length() > 0)) || (message.myAdditionalFixes != null && message.myAdditionalFixes.size() > 0)) { final AnAction[] defaultAction = new AnAction[1]; DefaultActionGroup popupGroup = new DefaultActionGroup() { @Override public void actionPerformed(@NotNull AnActionEvent e) { defaultAction[0].actionPerformed(e); } }; popupGroup.setPopup(true); popupGroup.getTemplatePresentation().setPerformGroup(true); action = popupGroup; if (message.myQuickFix != null && (message.myLinkText.length() > 0 || message.myAfterLinkText.length() > 0)) { AnAction popupAction = new AnAction() { @Override public void actionPerformed(@NotNull AnActionEvent e) { message.myQuickFix.run(); } }; popupAction.getTemplatePresentation().setText(cleanText(message.myLinkText + message.myAfterLinkText)); popupGroup.add(popupAction); defaultAction[0] = popupAction; } if (message.myAdditionalFixes != null && message.myAdditionalFixes.size() > 0) { for (final Pair<@Nls String, Runnable> pair : message.myAdditionalFixes) { AnAction popupAction = new AnAction() { @Override public void actionPerformed(@NotNull AnActionEvent e) { pair.second.run(); } }; popupAction.getTemplatePresentation().setText(cleanText(pair.first)); popupGroup.add(popupAction); if (defaultAction[0] == null) { defaultAction[0] = popupAction; } } } } else { action = new EmptyAction(true); } actionGroup.add(action); update(message, action.getTemplatePresentation(), true); } return actionGroup; }