Source:
<code>public void importData(@NotNull Collection<DataNode<ProjectImportEventMessage>> toImport, @NotNull final Project project, boolean synchronous) { final ExternalSystemIdeNotificationManager notificationManager = ServiceManager.getService(ExternalSystemIdeNotificationManager.class); if (notificationManager == null) { return; } final List<NotificationHyperlink> hyperlinks = Lists.newArrayList(); Multimap<String, ProjectImportEventMessage.Content> messagesByCategory = ArrayListMultimap.create(); for (DataNode<ProjectImportEventMessage> node : toImport) { ProjectImportEventMessage message = node.getData(); String category = message.getCategory(); messagesByCategory.put(category, message.getContent()); LOG.info(message.toString()); } if (messagesByCategory.isEmpty()) { return; } final StringBuilder builder = new StringBuilder(); for (String category : messagesByCategory.keySet()) { Collection<ProjectImportEventMessage.Content> messages = messagesByCategory.get(category); if (category.isEmpty()) { Joiner.on("\n").join(messages); } else { builder.append(category).append("\n"); for (ProjectImportEventMessage.Content message : messages) { <START> builder.append("- ").append(message.getText()); <END> NotificationHyperlink hyperlink = message.getHyperlink(); if (hyperlink != null) { hyperlinks.add(hyperlink); builder.append(" ").append(hyperlink.toString()); } builder.append("\n"); } builder.append("\n\n"); } } ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { String title = String.format("Problems importing/refreshing Gradle project '%1$s':\n", project.getName()); String messageToShow = builder.toString(); NotificationListener listener = null; if (!hyperlinks.isEmpty()) { listener = new CustomNotificationListener(project, hyperlinks.toArray(new NotificationHyperlink[hyperlinks.size()])); } notificationManager.showNotification(title, messageToShow, NotificationType.ERROR, project, GradleConstants.SYSTEM_ID, listener); } }); }</code><technical_language>need do a StringUtil.escapeXml message.getText() here; ditto hyperlink.toString in case ",&,<,' in strings</technical_language>

Target:
public void importData(@NotNull Collection<DataNode<ProjectImportEventMessage>> toImport, @NotNull final Project project, boolean synchronous) { final ExternalSystemIdeNotificationManager notificationManager = ServiceManager.getService(ExternalSystemIdeNotificationManager.class); if (notificationManager == null) { return; } final List<NotificationHyperlink> hyperlinks = Lists.newArrayList(); Multimap<String, ProjectImportEventMessage.Content> messagesByCategory = ArrayListMultimap.create(); for (DataNode<ProjectImportEventMessage> node : toImport) { ProjectImportEventMessage message = node.getData(); String category = message.getCategory(); messagesByCategory.put(category, message.getContent()); LOG.info(message.toString()); } if (messagesByCategory.isEmpty()) { return; } final StringBuilder builder = new StringBuilder(); for (String category : messagesByCategory.keySet()) { Collection<ProjectImportEventMessage.Content> messages = messagesByCategory.get(category); if (category.isEmpty()) { Joiner.on('\n').join(messages); } else { builder.append(category).append('\n'); for (ProjectImportEventMessage.Content message : messages) { builder.append("- ").append(message.getText()); NotificationHyperlink hyperlink = message.getHyperlink(); if (hyperlink != null) { hyperlinks.add(hyperlink); builder.append(" ").append(hyperlink.toString()); } builder.append('\n'); } builder.append("\n\n"); } } ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { String title = String.format("Problems importing/refreshing Gradle project '%1$s':\n", project.getName()); String messageToShow = builder.toString(); NotificationListener listener = null; if (!hyperlinks.isEmpty()) { listener = new CustomNotificationListener(project, hyperlinks.toArray(new NotificationHyperlink[hyperlinks.size()])); } notificationManager.showNotification(title, messageToShow, NotificationType.ERROR, project, GradleConstants.SYSTEM_ID, listener); } }); }