diff --git a/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/InfiniteProgress.java b/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/InfiniteProgress.java index b052c1b1051..61fc86ad152 100644 --- a/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/InfiniteProgress.java +++ b/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/InfiniteProgress.java @@ -21,6 +21,7 @@ * is too costly. The monitor will accept any number of calls to * {@link #worked()}, and will scale the actual reported work appropriately * so that the progress never quite completes. + *

Note, this monitor will only report progress if the thread calling it is the same as the thread that created it.

*/ public class InfiniteProgress { private final int MAX_TICKS = 172; // will be reached after ~ 1 Billion #worked() @@ -28,17 +29,23 @@ public class InfiniteProgress { private int nextTickAfter = 4; private int workReported; private final IProgressMonitor monitor; + private final Thread myThread; protected InfiniteProgress(IProgressMonitor monitor) { this.monitor = monitor; + myThread = Thread.currentThread(); } public void beginTask(String name) { - monitor.beginTask(name, MAX_TICKS); + if (myThread == Thread.currentThread()) { + monitor.beginTask(name, MAX_TICKS); + } } public synchronized void subTask(String name) { - monitor.subTask(name); + if (myThread == Thread.currentThread()) { + monitor.subTask(name); + } } public synchronized void worked() { @@ -49,7 +56,9 @@ public synchronized void worked() { nextTickAfter = 1 + (int) (nextTickAfter * 1.1f); if (workReported < MAX_TICKS) { workReported++; - monitor.worked(1); + if (myThread == Thread.currentThread()) { + monitor.worked(1); + } } } }