void (@NotNull VMOptions.MemoryKind kind, boolean error) { if (!ourNotifications.add(kind)) return; var message = error ? IdeBundle.message("low.memory.notification.error", kind.label()) : IdeBundle.message("low.memory.notification.warning"); var type = error ? NotificationType.ERROR : NotificationType.WARNING; var notification = new Notification("Low Memory", IdeBundle.message("low.memory.notification.title"), message, type); notification.addAction(NotificationAction.createSimpleExpiring(IdeBundle.message("low.memory.notification.analyze.action"), () -> new HeapDumpSnapshotRunnable(MemoryReportReason.UserInvoked, HeapDumpSnapshotRunnable.AnalysisOption.SCHEDULE_ON_NEXT_START).run())); if (VMOptions.canWriteOptions()) { notification.addAction(NotificationAction.createSimpleExpiring(IdeBundle.message("low.memory.notification.action"), () -> new EditMemorySettingsDialog(kind).show())); } notification.whenExpired(() -> ourNotifications.remove(kind)); Notifications.Bus.notify(notification); }