EA-42827 postpone displaying ballons until the application is loaded to fix notification-induced cyclic component initialization

This commit is contained in:
peter
2013-01-21 17:19:57 +01:00
parent 366fd130ee
commit e3d67fb89a
@@ -20,6 +20,8 @@ import com.intellij.notification.*;
import com.intellij.notification.impl.ui.NotificationsUtil;
import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.application.ex.ApplicationEx;
import com.intellij.openapi.project.DumbAwareRunnable;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
@@ -111,6 +113,18 @@ public class NotificationsManagerImpl extends NotificationsManager {
}
private static void showNotification(final Notification notification, @Nullable final Project project) {
Application application = ApplicationManager.getApplication();
if (application instanceof ApplicationEx && !((ApplicationEx)application).isLoaded()) {
application.invokeLater(new Runnable() {
@Override
public void run() {
showNotification(notification, project);
}
}, ModalityState.current());
return;
}
String groupId = notification.getGroupId();
final NotificationSettings settings = NotificationsConfigurationImpl.getSettings(groupId);