[platform] checks 'ProgressIndicator.isCanceled()' right before finishing a task

This commit is contained in:
Roman Shevchenko
2017-02-08 15:52:49 +01:00
parent 574bca3201
commit e2f099e548
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -473,17 +473,16 @@ public class CoreProgressManager extends ProgressManager implements Disposable {
exception = e;
}
final boolean finalCanceled = processCanceled || progressIndicator.isCanceled();
final Throwable finalException = exception;
if (ApplicationManager.getApplication().isDispatchThread()) {
finishTask(task, finalCanceled, finalException);
finishTask(task, processCanceled || progressIndicator.isCanceled(), exception);
}
else {
final boolean finalCanceled = processCanceled;
final Throwable finalException = exception;
ApplicationManager.getApplication().invokeAndWait(new Runnable() {
@Override
public void run() {
finishTask(task, finalCanceled, finalException);
finishTask(task, finalCanceled || progressIndicator.isCanceled(), finalException);
}
}, modalityState);
}