mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
non-modal notification for settings file corruption (PY-1028)
This commit is contained in:
+8
-11
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user