mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-55568 Allow AsyncResult to return value when rejected
This commit is contained in:
@@ -25,6 +25,12 @@ public class AsyncResult<T> extends ActionCallback {
|
||||
return this;
|
||||
}
|
||||
|
||||
public AsyncResult<T> setRejected(T result) {
|
||||
myResult = result;
|
||||
super.setRejected();
|
||||
return this;
|
||||
}
|
||||
|
||||
public AsyncResult<T> doWhenDone(final Handler<T> handler) {
|
||||
doWhenDone(new Runnable() {
|
||||
public void run() {
|
||||
@@ -34,6 +40,15 @@ public class AsyncResult<T> extends ActionCallback {
|
||||
return this;
|
||||
}
|
||||
|
||||
public AsyncResult<T> doWhenRejected(final Handler<T> handler) {
|
||||
doWhenRejected(new Runnable() {
|
||||
public void run() {
|
||||
handler.run(myResult);
|
||||
}
|
||||
});
|
||||
return this;
|
||||
}
|
||||
|
||||
public T getResult() {
|
||||
return myResult;
|
||||
}
|
||||
@@ -52,6 +67,10 @@ public class AsyncResult<T> extends ActionCallback {
|
||||
public Rejected() {
|
||||
setRejected();
|
||||
}
|
||||
|
||||
public Rejected(T value) {
|
||||
setRejected(value);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user