From 05de46ddbc1323228a45ee13ad4ffd6a8ff1edce Mon Sep 17 00:00:00 2001 From: Kirill Kalishev Date: Mon, 7 Jun 2010 15:02:10 +0400 Subject: [PATCH] IDEA-55568 Allow AsyncResult to return value when rejected --- .../intellij/openapi/util/AsyncResult.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/platform/platform-api/src/com/intellij/openapi/util/AsyncResult.java b/platform/platform-api/src/com/intellij/openapi/util/AsyncResult.java index 299bb5c2f913..dbc1981673a1 100644 --- a/platform/platform-api/src/com/intellij/openapi/util/AsyncResult.java +++ b/platform/platform-api/src/com/intellij/openapi/util/AsyncResult.java @@ -25,6 +25,12 @@ public class AsyncResult extends ActionCallback { return this; } + public AsyncResult setRejected(T result) { + myResult = result; + super.setRejected(); + return this; + } + public AsyncResult doWhenDone(final Handler handler) { doWhenDone(new Runnable() { public void run() { @@ -34,6 +40,15 @@ public class AsyncResult extends ActionCallback { return this; } + public AsyncResult doWhenRejected(final Handler handler) { + doWhenRejected(new Runnable() { + public void run() { + handler.run(myResult); + } + }); + return this; + } + public T getResult() { return myResult; } @@ -52,6 +67,10 @@ public class AsyncResult extends ActionCallback { public Rejected() { setRejected(); } + + public Rejected(T value) { + setRejected(value); + } } } \ No newline at end of file