void (Notification notification, NotificationCenterPanel centerPanel, int gap, HoverAdapter hoverAdapter) { NotificationActionPanel actionPanel = new NotificationActionPanel(gap, notification.getCollapseDirection()); centerPanel.addActionPanel(actionPanel); List<AnAction> actions = notification.getActions(); int actionsSize = actions.size(); if (notification.isSuggestionType()) { if (actionsSize > 0) { AnAction action = actions.get(0); JButton button = new JButton(action.getTemplateText()); button.setOpaque(false); setButtonColor(button, "Notification.Button.foreground", "JButton.textColor"); setButtonColor(button, "Notification.Button.background", "JButton.backgroundColor"); setButtonColor(button, "Notification.Button.borderColor", "JButton.borderColor"); actionPanel.addAction(button); button.addActionListener(e -> { NotificationCollector.getInstance() .logNotificationActionInvoked(null, notification, action, NotificationCollector.NotificationPlace.BALLOON); Notification.fire(notification, action, DataManager.getInstance().getDataContext(button)); }); Notification.setDataProvider(notification, button); actionPanel.checkActionWidth = actionsSize > 1; if (actionsSize == 2) { actionPanel.addAction(createAction(notification, actions.get(1))); } else if (actionsSize > 2) { DefaultActionGroup group = new DefaultActionGroup(); for (int i = 1; i < actionsSize; i++) { group.add(actions.get(i)); } DropDownAction dropDownAction = new DropDownAction(IdeCoreBundle.message("notifications.action.more"), (link, _1) -> showPopup(notification, link, group, actionPanel.popupAlarm)); actionPanel.addAction(dropDownAction); Notification.setDataProvider(notification, dropDownAction); } } } else { if (actionsSize > 1 && notification.getCollapseDirection() == Notification.CollapseActionsDirection.KEEP_RIGHTMOST) { addDropDownAction(notification, actionPanel); } for (AnAction action : actions) { actionPanel.addActionLink(createAction(notification, action)); } if (actionsSize > 1 && notification.getCollapseDirection() == Notification.CollapseActionsDirection.KEEP_LEFTMOST) { addDropDownAction(notification, actionPanel); } } AnAction helpAction = notification.getContextHelpAction(); if (helpAction != null) { Presentation presentation = helpAction.getTemplatePresentation(); ContextHelpLabel helpLabel = ContextHelpLabel.create(StringUtil.defaultIfEmpty(presentation.getText(), ""), presentation.getDescription()); helpLabel.setForeground(UIUtil.getLabelDisabledForeground()); actionPanel.addAction(helpLabel); } Insets hover = JBUI.insets(8, 5, 8, 7); int count = actionPanel.getComponentCount(); for (int i = 0; i < count; i++) { hoverAdapter.addComponent(actionPanel.getComponent(i), hover); } hoverAdapter.addSource(actionPanel); }