Search in sources :

Example 1 with ConfigurationErrorType

use of com.intellij.openapi.module.ConfigurationErrorType in project intellij-community by JetBrains.

the class ProjectLoadingErrorsNotifierImpl method fireNotifications.

private void fireNotifications() {
    final MultiMap<ConfigurationErrorType, ConfigurationErrorDescription> descriptionsMap = new MultiMap<>();
    synchronized (myLock) {
        if (myErrors.isEmpty())
            return;
        descriptionsMap.putAllValues(myErrors);
        myErrors.clear();
    }
    for (final ConfigurationErrorType type : descriptionsMap.keySet()) {
        final Collection<ConfigurationErrorDescription> descriptions = descriptionsMap.get(type);
        if (descriptions.isEmpty())
            continue;
        final String invalidElements = getInvalidElementsString(type, descriptions);
        final String errorText = ProjectBundle.message("error.message.configuration.cannot.load") + " " + invalidElements + " <a href=\"\">Details...</a>";
        Notifications.Bus.notify(new Notification("Project Loading Error", "Error Loading Project", errorText, NotificationType.ERROR, new NotificationListener() {

            @Override
            public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
                final List<ConfigurationErrorDescription> validDescriptions = ContainerUtil.findAll(descriptions, errorDescription -> errorDescription.isValid());
                if (RemoveInvalidElementsDialog.showDialog(myProject, CommonBundle.getErrorTitle(), type, invalidElements, validDescriptions)) {
                    notification.expire();
                }
            }
        }), myProject);
    }
}
Also used : MultiMap(com.intellij.util.containers.MultiMap) HyperlinkEvent(javax.swing.event.HyperlinkEvent) ConfigurationErrorDescription(com.intellij.openapi.module.ConfigurationErrorDescription) ConfigurationErrorType(com.intellij.openapi.module.ConfigurationErrorType) NotNull(org.jetbrains.annotations.NotNull) Notification(com.intellij.notification.Notification) NotificationListener(com.intellij.notification.NotificationListener)

Aggregations

Notification (com.intellij.notification.Notification)1 NotificationListener (com.intellij.notification.NotificationListener)1 ConfigurationErrorDescription (com.intellij.openapi.module.ConfigurationErrorDescription)1 ConfigurationErrorType (com.intellij.openapi.module.ConfigurationErrorType)1 MultiMap (com.intellij.util.containers.MultiMap)1 HyperlinkEvent (javax.swing.event.HyperlinkEvent)1 NotNull (org.jetbrains.annotations.NotNull)1