void (final FixableMessageInfo message, Icon icon) { if (message.myLinkText.length() > 0 || message.myAfterLinkText.length() > 0) { HyperlinkLabel warnLabel = new HyperlinkLabel(); warnLabel.setOpaque(false); warnLabel.setHyperlinkText(message.myBeforeLinkText, message.myLinkText, message.myAfterLinkText); warnLabel.setIcon(icon); if (message.myQuickFix != null) { warnLabel.addHyperlinkListener(new HyperlinkListener() { @Override public void hyperlinkUpdate(final HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { message.myQuickFix.run(); } } }); } myErrorMessages.add(warnLabel); } else { JBLabel warnLabel = new JBLabel(); warnLabel.setOpaque(false); warnLabel.setText("<html><body>" + message.myBeforeLinkText.replace("\n", "<br>") + "</body></html>"); warnLabel.setIcon(icon); myErrorMessages.add(warnLabel); } if (message.myAdditionalFixes != null && message.myAdditionalFixes.size() > 0) { JPanel fixesPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0)); fixesPanel.setBorder(JBUI.Borders.empty(3, 0, 10, 0)); fixesPanel.setOpaque(false); fixesPanel.add(Box.createHorizontalStrut(icon.getIconWidth())); for (Pair<@Nls String, Runnable> pair : message.myAdditionalFixes) { HyperlinkLabel fixLabel = new HyperlinkLabel(); fixLabel.setOpaque(false); fixLabel.setHyperlinkText(pair.getFirst()); final Runnable fix = pair.getSecond(); fixLabel.addHyperlinkListener(new HyperlinkListener() { @Override public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { fix.run(); } } }); fixesPanel.add(fixLabel); } myErrorMessages.add(fixesPanel); } }