Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Prigogin2016-10-19 19:21:08 -0400
committerSergey Prigogin2016-10-19 19:21:08 -0400
commit3b09efc420b7a1a8110062b8f393acd757d4bc90 (patch)
tree3c3be882a306345d0193fdc71578c230d1be8522
parenta4fb61b98bec0b2ef52afbe248f21b0195781dbf (diff)
downloadeclipse.platform.team-3b09efc420b7a1a8110062b8f393acd757d4bc90.tar.gz
eclipse.platform.team-3b09efc420b7a1a8110062b8f393acd757d4bc90.tar.xz
eclipse.platform.team-3b09efc420b7a1a8110062b8f393acd757d4bc90.zip
Bug 506190 - AsyncExecTests.testCancelOnRequeue fails on all platforms
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Worker.java22
1 files changed, 10 insertions, 12 deletions
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Worker.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Worker.java
index 724ca183b..3582c1b31 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Worker.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Worker.java
@@ -62,22 +62,25 @@ public class Worker implements IRunnableWithProgress {
@Override
public void run(IProgressMonitor monitor) {
errors.clear();
- SubMonitor pm = SubMonitor.convert(monitor, getTaskName(), 100);
+ SubMonitor progress = SubMonitor.convert(monitor, getTaskName(), 100);
try {
isWorking = true;
while (!work.isEmpty()) {
try {
- performNextTask(pm);
- checkCancelled(pm);
+ performNextTask(progress);
+ progress.checkCanceled();
+ } catch (OperationCanceledException e) {
+ // Only cancel all the work if the outer monitor is canceled.
+ progress.checkCanceled();
} catch (InterruptedException e) {
- // Only cancel all the work if the outer monitor is canceled
- checkCancelled(pm);
+ // Only cancel all the work if the outer monitor is canceled.
+ progress.checkCanceled();
} catch (InvocationTargetException e) {
handleError(e.getTargetException());
}
- pm.setWorkRemaining(100);
+ progress.setWorkRemaining(100);
}
- pm.done();
+ progress.done();
} catch (OperationCanceledException e) {
// The user chose to cancel
work.clear();
@@ -100,11 +103,6 @@ public class Worker implements IRunnableWithProgress {
return errors.toArray(new Throwable[errors.size()]);
}
- private void checkCancelled(SubMonitor pm) {
- if (pm.isCanceled())
- throw new OperationCanceledException();
- }
-
protected String getTaskName() {
return taskName;
}

Back to the top