use of org.sonarlint.eclipse.core.internal.utils.StringUtils in project sonarlint-eclipse by SonarSource.
the class SkippedPluginsNotifier method notifyForSkippedPlugins.
public static void notifyForSkippedPlugins(Collection<PluginDetails> allPlugins, @Nullable String connectionId) {
var skippedPlugins = allPlugins.stream().filter(p -> p.skipReason().isPresent() && !(p.skipReason().get() instanceof SkipReason.UnsatisfiedRuntimeRequirement)).collect(toList());
if (!skippedPlugins.isEmpty()) {
var skippedLanguages = skippedPlugins.stream().flatMap(p -> getLanguagesByPluginKey(p.key()).stream()).filter(l -> getEnabledLanguages().contains(l)).collect(toList());
var longMessage = buildLongMessage(connectionId, skippedPlugins, skippedLanguages);
String notificationTitle;
String notificationMsg;
if (skippedLanguages.isEmpty()) {
notificationTitle = "Rules not available";
notificationMsg = "Some rules are not available until some requirements are satisfied";
} else {
notificationTitle = "Language analysis not available";
notificationMsg = String.format("%s analysis will not be available until some requirements are satisfied", skippedLanguages.stream().map(Language::getLanguageKey).map(StringUtils::capitalize).collect(Collectors.joining(", ")));
}
SonarLintNotifications.get().showNotification(new Notification(notificationTitle, notificationMsg, longMessage));
}
}
Aggregations