use of com.intellij.openapi.module.ConfigurationErrorDescription 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);
}
}
use of com.intellij.openapi.module.ConfigurationErrorDescription in project intellij-community by JetBrains.
the class RemoveInvalidElementsDialog method showDialog.
/**
* @return {@code true} if the problems are resolved
*/
public static boolean showDialog(@NotNull Project project, @NotNull String title, ConfigurationErrorType type, @NotNull String invalidElements, @NotNull List<ConfigurationErrorDescription> errors) {
if (errors.isEmpty()) {
return true;
}
if (errors.size() == 1) {
ConfigurationErrorDescription error = errors.get(0);
String message = error.getDescription() + "\n" + error.getIgnoreConfirmationMessage();
final int answer = Messages.showYesNoDialog(project, message, title, Messages.getErrorIcon());
if (answer == Messages.YES) {
error.ignoreInvalidElement();
return true;
}
return false;
}
RemoveInvalidElementsDialog dialog = new RemoveInvalidElementsDialog(title, type, invalidElements, project, errors);
if (dialog.showAndGet()) {
for (ConfigurationErrorDescription errorDescription : dialog.getSelectedItems()) {
errorDescription.ignoreInvalidElement();
}
return true;
}
return false;
}
Aggregations