From f960fa18398f357f003bdc2bb3252d966ac513f7 Mon Sep 17 00:00:00 2001 From: Anton Makeev Date: Mon, 6 May 2013 11:57:21 +0200 Subject: [PATCH] Platform: whenExpired callback for Notification +review CR-IC @gromopetr --- .../src/com/intellij/notification/Notification.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/platform/platform-api/src/com/intellij/notification/Notification.java b/platform/platform-api/src/com/intellij/notification/Notification.java index 7baeac1666e3..5a538dcbfba2 100644 --- a/platform/platform-api/src/com/intellij/notification/Notification.java +++ b/platform/platform-api/src/com/intellij/notification/Notification.java @@ -38,6 +38,7 @@ public class Notification { private final NotificationListener myListener; private final String myTitle; private boolean myExpired; + private Runnable myWhenExpired; private Boolean myImportant; private WeakReference myBalloonRef; @@ -102,6 +103,14 @@ public class Notification { NotificationsManager.getNotificationsManager().expire(this); hideBalloon(); myExpired = true; + + Runnable whenExpired = myWhenExpired; + if (whenExpired != null) whenExpired.run(); + } + + public Notification whenExpired(@Nullable Runnable whenExpired) { + myWhenExpired = whenExpired; + return this; } public void hideBalloon() {