ActionGroup (final ContextHolder holder, final Ref<Boolean> shiftPressed) { String text = DateFormatUtil.formatPrettyDateTime(holder.getDate()); String comment = holder.getComment(); if (!StringUtil.isEmpty(comment)) { text = comment + " (" + text + ")"; } final AnAction loadAction = new AnAction(TaskBundle.messagePointer("action.LoadContextAction.Anonymous.text.load")) { @Override public void actionPerformed(@NotNull AnActionEvent e) { holder.load(!shiftPressed.get()); } }; ActionGroup contextGroup = new ActionGroup(text, text, holder.getIcon()) { @Override public void actionPerformed(@NotNull AnActionEvent e) { loadAction.actionPerformed(e); } @Override public AnAction @NotNull [] getChildren(@Nullable AnActionEvent e) { return new AnAction[]{loadAction, new AnAction(TaskBundle.messagePointer("action.LoadContextAction.Anonymous.text.remove")) { @Override public void actionPerformed(@NotNull AnActionEvent e) { holder.remove(); } }}; } }; contextGroup.setPopup(true); contextGroup.getTemplatePresentation().setPerformGroup(true); return contextGroup; }