Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Baumgart2012-04-03 14:16:06 +0000
committerMatthias Sohn2012-04-03 14:16:06 +0000
commit6bff046874e3b51dcef78a65fe8a2631bdd7e3d8 (patch)
tree223f7031f3a612e6e9c17b2fd57d67bb4ab21dc8
parenta00ea5e5a134fa908980ddc1075a90a5d316fdea (diff)
downloadegit-6bff046874e3b51dcef78a65fe8a2631bdd7e3d8.tar.gz
egit-6bff046874e3b51dcef78a65fe8a2631bdd7e3d8.tar.xz
egit-6bff046874e3b51dcef78a65fe8a2631bdd7e3d8.zip
IndexDiff Cache: fix cancellation issue
It was not possible to cancel the "Re-indexing repository" job while this job was waiting for the workspace lock. Bug: 373077 Change-Id: Iade4dc9fa1445536e7a2a78ef0f22e82e2a331e2 Signed-off-by: Jens Baumgart <jens.baumgart@sap.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/internal/indexdiff/IndexDiffCacheEntry.java14
1 files changed, 8 insertions, 6 deletions
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/indexdiff/IndexDiffCacheEntry.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/indexdiff/IndexDiffCacheEntry.java
index ced44b344c..0b001d3a3f 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/indexdiff/IndexDiffCacheEntry.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/indexdiff/IndexDiffCacheEntry.java
@@ -24,7 +24,7 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.egit.core.Activator;
@@ -168,7 +168,7 @@ public class IndexDiffCacheEntry {
reloadJob = new Job(getReloadJobName()) {
@Override
protected IStatus run(IProgressMonitor monitor) {
- waitForWorkspaceLock();
+ waitForWorkspaceLock(monitor);
if (monitor.isCanceled())
return Status.CANCEL_STATUS;
lock.lock();
@@ -227,7 +227,7 @@ public class IndexDiffCacheEntry {
return true;
}
- private void waitForWorkspaceLock() {
+ private void waitForWorkspaceLock(IProgressMonitor monitor) {
// Wait for the workspace lock to avoid starting the calculation
// of an IndexDiff while the workspace changes (e.g. due to a
// branch switch).
@@ -236,10 +236,12 @@ public class IndexDiffCacheEntry {
try {
ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
+ public void run(IProgressMonitor innerMonitor) throws CoreException {
// empty
}
- }, new NullProgressMonitor());
+ }, monitor);
+ } catch (OperationCanceledException e) {
+ return;
} catch (CoreException e) {
throw new RuntimeException(e);
}
@@ -252,7 +254,7 @@ public class IndexDiffCacheEntry {
Job job = new Job(getReloadJobName()) {
@Override
protected IStatus run(IProgressMonitor monitor) {
- waitForWorkspaceLock();
+ waitForWorkspaceLock(monitor);
if (monitor.isCanceled())
return Status.CANCEL_STATUS;
lock.lock();

Back to the top