From 2e0eec6aaa239d8d16ad83356f63f66c20b27cdf Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Sat, 17 Jul 2010 15:33:29 +0400 Subject: [PATCH] non-modal notification for settings file corruption (PY-1028) --- .../impl/stores/FileBasedStorage.java | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/FileBasedStorage.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/FileBasedStorage.java index 8f17489d1067..8fa56205de5b 100644 --- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/FileBasedStorage.java +++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/FileBasedStorage.java @@ -17,6 +17,9 @@ package com.intellij.openapi.components.impl.stores; import com.intellij.Patches; +import com.intellij.notification.Notification; +import com.intellij.notification.NotificationType; +import com.intellij.notification.Notifications; import com.intellij.openapi.Disposable; import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; @@ -39,7 +42,6 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.picocontainer.PicoContainer; -import javax.swing.*; import java.io.File; import java.io.IOException; import java.io.InputStream; @@ -255,16 +257,11 @@ public class FileBasedStorage extends XmlElementStorage { private Document processReadException(final Exception e) { myBlockSavingTheContent = isProjectOrModuleFile(); if (!ApplicationManager.getApplication().isUnitTestMode() && !ApplicationManager.getApplication().isHeadlessEnvironment()) { - LOG.warn(e); - SwingUtilities.invokeLater(new Runnable(){ - public void run() { - JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), - "Cannot load settings from file '" + myFile.getPath() + "': " + e.getLocalizedMessage() + "\n" + - getInvalidContentMessage(), - "Load Settings", - JOptionPane.ERROR_MESSAGE); - } - }); + LOG.info(e); + final String message = "Cannot load settings from file '" + myFile.getPath() + "': " + e.getLocalizedMessage() + "\n" + + getInvalidContentMessage(); + Notifications.Bus.notify( + new Notification(Notifications.SYSTEM_MESSAGES_GROUP_ID, "Load Settings", message, NotificationType.WARNING)); } return null;