Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2003-09-23 14:04:34 +0000
committerJean Michel-Lemieux2003-09-23 14:04:34 +0000
commit655f96f5a52f5ef6b437cdc80449d83dd4ae5b02 (patch)
tree07b289ad099ed3ecaccd07ec678dd327bfa5ddfb
parent6a238d53a05a30c5be0cbba8724a055e8256cca1 (diff)
downloadeclipse.platform.team-655f96f5a52f5ef6b437cdc80449d83dd4ae5b02.tar.gz
eclipse.platform.team-655f96f5a52f5ef6b437cdc80449d83dd4ae5b02.tar.xz
eclipse.platform.team-655f96f5a52f5ef6b437cdc80449d83dd4ae5b02.zip
Bug 43469 Cancelling Merge does work in UI thread
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/BackgroundEventHandler.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/CancelSubscription.java7
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerSubscriberListActions.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SubscriberEventHandler.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SynchronizeView.java8
5 files changed, 12 insertions, 9 deletions
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/BackgroundEventHandler.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/BackgroundEventHandler.java
index 74d0f5958..cb06b607e 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/BackgroundEventHandler.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/BackgroundEventHandler.java
@@ -177,7 +177,7 @@ public abstract class BackgroundEventHandler {
IProgressMonitor subMonitor = Policy.infiniteSubMonitorFor(monitor, 90);
subMonitor.beginTask(null, 1024);
- while ((event = nextElement()) != null) {
+ while ((event = nextElement()) != null && ! shutdown) {
// Cancellation is dangerous because this will leave the sync info in a bad state.
// Purposely not checking -
try {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/CancelSubscription.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/CancelSubscription.java
index 3f48529ab..63b7102ea 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/CancelSubscription.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/CancelSubscription.java
@@ -13,19 +13,22 @@ package org.eclipse.team.internal.ui.sync.actions;
import org.eclipse.jface.action.Action;
import org.eclipse.team.core.subscribers.TeamSubscriber;
import org.eclipse.team.internal.ui.Utils;
+import org.eclipse.team.internal.ui.sync.views.SynchronizeView;
class CancelSubscription extends Action {
private TeamSubscriber subscriber;
+ private SynchronizeView view;
- public CancelSubscription(TeamSubscriber s) {
+ public CancelSubscription(SynchronizeView view, TeamSubscriber s) {
this.subscriber = s;
+ this.view = view;
Utils.initAction(this, "action.cancelSubscriber."); //$NON-NLS-1$
// don't enable until necessary
setEnabled(false);
}
public void run() {
- subscriber.cancel();
+ view.removeSubscriber(subscriber);
}
public void setSubscriber(TeamSubscriber subscriber) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerSubscriberListActions.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerSubscriberListActions.java
index a3f145eb3..827b977a0 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerSubscriberListActions.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerSubscriberListActions.java
@@ -120,7 +120,7 @@ public class SyncViewerSubscriberListActions extends SyncViewerActionGroup {
SwitchSubscriberAction action = new SwitchSubscriberAction(input);
actions.put(input.getSubscriber().getId(), action);
if(cancelAction == null) {
- cancelAction = new CancelSubscription(input.getSubscriber());
+ cancelAction = new CancelSubscription(getSyncView(), input.getSubscriber());
}
if(enableFirstContext) {
activate(action);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SubscriberEventHandler.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SubscriberEventHandler.java
index bcf6f086f..43bfe6658 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SubscriberEventHandler.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SubscriberEventHandler.java
@@ -225,7 +225,7 @@ public class SubscriberEventHandler {
IProgressMonitor subMonitor = Policy.subInfiniteMonitorFor(monitor, 90);
subMonitor.beginTask(null, 1024);
- while ((event = nextElement()) != null) {
+ while ((event = nextElement()) != null && ! shutdown) {
// Cancellation is dangerous because this will leave the sync info in a bad state.
// Purposely not checking -
try {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SynchronizeView.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SynchronizeView.java
index b769531fb..a4ac27c96 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SynchronizeView.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SynchronizeView.java
@@ -539,9 +539,6 @@ public class SynchronizeView extends ViewPart implements ITeamResourceChangeList
if(delta.getFlags() == TeamDelta.SUBSCRIBER_CREATED) {
TeamSubscriber s = delta.getSubscriber();
addSubscriber(s);
- } else if(delta.getFlags() == TeamDelta.SUBSCRIBER_DELETED) {
- TeamSubscriber s = delta.getSubscriber();
- removeSubscriber(s);
}
}
}
@@ -558,7 +555,7 @@ public class SynchronizeView extends ViewPart implements ITeamResourceChangeList
actions.addContext(context);
}
- synchronized private void removeSubscriber(TeamSubscriber s) {
+ synchronized public void removeSubscriber(TeamSubscriber s) {
// notify that context is changing
SubscriberInput si = (SubscriberInput)subscriberInputs.get(s.getId());
ActionContext context = new ActionContext(null);
@@ -571,6 +568,9 @@ public class SynchronizeView extends ViewPart implements ITeamResourceChangeList
// forget about this input
subscriberInputs.remove(s.getId());
+ // de-register the subscriber with the platform
+ s.cancel();
+
if (si == input) {
if (subscriberInputs.isEmpty()) {
disconnectSubscriberInput();

Back to the top