non-modal notification for settings file corruption (PY-1028)
[idea/community.git] / platform / platform-impl / src / com / intellij / openapi / components / impl / stores / FileBasedStorage.java
index 8f17489d106763f9ae7e74ca92077063081a30b8..8fa56205de5b2f2607d848117eaeb979a2d317d6 100644 (file)
@@ -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;