Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2009-10-15 18:52:36 -0400
committerspingel2009-10-15 18:52:36 -0400
commite40216638ed9292c2d7339e5a47bd12495d512b5 (patch)
tree0d38490eeddce85c0b0cb05719f7fec0c9199399 /org.eclipse.mylyn.tasks.core
parent715afba7e46926fe99d4a81c231cff996ce1b655 (diff)
downloadorg.eclipse.mylyn.tasks-e40216638ed9292c2d7339e5a47bd12495d512b5.tar.gz
org.eclipse.mylyn.tasks-e40216638ed9292c2d7339e5a47bd12495d512b5.tar.xz
org.eclipse.mylyn.tasks-e40216638ed9292c2d7339e5a47bd12495d512b5.zip
NEW - bug 292466: background synchronization stops if active synchronization is canceled
https://bugs.eclipse.org/bugs/show_bug.cgi?id=292466
Diffstat (limited to 'org.eclipse.mylyn.tasks.core')
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SubmitTaskJob.java73
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizeQueriesJob.java179
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizeRepositoriesJob.java98
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizeTasksJob.java69
4 files changed, 221 insertions, 198 deletions
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SubmitTaskJob.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SubmitTaskJob.java
index 0be919c7a..2c9dd1589 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SubmitTaskJob.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SubmitTaskJob.java
@@ -69,43 +69,50 @@ public class SubmitTaskJob extends SubmitJob {
@Override
protected IStatus run(IProgressMonitor jobMonitor) {
- monitor.attach(jobMonitor);
try {
- monitor.beginTask(Messages.SubmitTaskJob_Submitting_task, 2 * (1 + getSubmitJobListeners().length) * 100);
-
- // post task data
- AbstractTaskDataHandler taskDataHandler = connector.getTaskDataHandler();
- monitor.subTask(Messages.SubmitTaskJob_Sending_data);
- response = taskDataHandler.postTaskData(taskRepository, taskData, oldAttributes, Policy.subMonitorFor(
- monitor, 100));
- if (response == null || response.getTaskId() == null) {
- throw new CoreException(new RepositoryStatus(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN,
- RepositoryStatus.ERROR_INTERNAL,
- "Task could not be created. No additional information was provided by the connector.")); //$NON-NLS-1$
+ monitor.setCanceled(false);
+ monitor.attach(jobMonitor);
+ try {
+ monitor.beginTask(Messages.SubmitTaskJob_Submitting_task,
+ 2 * (1 + getSubmitJobListeners().length) * 100);
+
+ // post task data
+ AbstractTaskDataHandler taskDataHandler = connector.getTaskDataHandler();
+ monitor.subTask(Messages.SubmitTaskJob_Sending_data);
+ response = taskDataHandler.postTaskData(taskRepository, taskData, oldAttributes, Policy.subMonitorFor(
+ monitor, 100));
+ if (response == null || response.getTaskId() == null) {
+ throw new CoreException(new RepositoryStatus(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN,
+ RepositoryStatus.ERROR_INTERNAL,
+ "Task could not be created. No additional information was provided by the connector.")); //$NON-NLS-1$
+ }
+ fireTaskSubmitted(monitor);
+
+ // update task in task list
+ String taskId = response.getTaskId();
+ monitor.subTask(Messages.SubmitTaskJob_Receiving_data);
+ TaskData updatedTaskData = connector.getTaskData(taskRepository, taskId, Policy.subMonitorFor(monitor,
+ 100));
+ task = createTask(monitor, updatedTaskData);
+ taskDataManager.putSubmittedTaskData(task, updatedTaskData);
+ fireTaskSynchronized(monitor);
+ } catch (CoreException e) {
+ errorStatus = e.getStatus();
+ } catch (OperationCanceledException e) {
+ errorStatus = Status.CANCEL_STATUS;
+ } catch (Exception e) {
+ StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN,
+ "Unexpected error during task submission", e)); //$NON-NLS-1$
+ errorStatus = new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, "Unexpected error: " //$NON-NLS-1$
+ + e.getMessage(), e);
+ } finally {
+ monitor.done();
}
- fireTaskSubmitted(monitor);
-
- // update task in task list
- String taskId = response.getTaskId();
- monitor.subTask(Messages.SubmitTaskJob_Receiving_data);
- TaskData updatedTaskData = connector.getTaskData(taskRepository, taskId, Policy.subMonitorFor(monitor, 100));
- task = createTask(monitor, updatedTaskData);
- taskDataManager.putSubmittedTaskData(task, updatedTaskData);
- fireTaskSynchronized(monitor);
- } catch (CoreException e) {
- errorStatus = e.getStatus();
- } catch (OperationCanceledException e) {
- errorStatus = Status.CANCEL_STATUS;
- } catch (Exception e) {
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN,
- "Unexpected error during task submission", e)); //$NON-NLS-1$
- errorStatus = new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, "Unexpected error: " //$NON-NLS-1$
- + e.getMessage(), e);
+ fireDone();
+ return (errorStatus == Status.CANCEL_STATUS) ? Status.CANCEL_STATUS : Status.OK_STATUS;
} finally {
- monitor.done();
+ monitor.detach(jobMonitor);
}
- fireDone();
- return (errorStatus == Status.CANCEL_STATUS) ? Status.CANCEL_STATUS : Status.OK_STATUS;
}
private ITask createTask(IProgressMonitor monitor, TaskData updatedTaskData) throws CoreException {
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizeQueriesJob.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizeQueriesJob.java
index 7827423c9..8e15390a0 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizeQueriesJob.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizeQueriesJob.java
@@ -148,109 +148,114 @@ public class SynchronizeQueriesJob extends SynchronizationJob {
@Override
public IStatus run(IProgressMonitor jobMonitor) {
- monitor.attach(jobMonitor);
try {
- monitor.beginTask(Messages.SynchronizeQueriesJob_Processing, 20 + queries.size() * 20 + 40 + 10);
+ monitor.setCanceled(false);
+ monitor.attach(jobMonitor);
+ try {
+ monitor.beginTask(Messages.SynchronizeQueriesJob_Processing, 20 + queries.size() * 20 + 40 + 10);
- Set<ITask> allTasks;
- if (!isFullSynchronization()) {
- allTasks = new HashSet<ITask>();
- for (RepositoryQuery query : queries) {
- allTasks.addAll(query.getChildren());
+ Set<ITask> allTasks;
+ if (!isFullSynchronization()) {
+ allTasks = new HashSet<ITask>();
+ for (RepositoryQuery query : queries) {
+ allTasks.addAll(query.getChildren());
+ }
+ } else {
+ allTasks = taskList.getTasks(repository.getRepositoryUrl());
}
- } else {
- allTasks = taskList.getTasks(repository.getRepositoryUrl());
- }
- ObjectSchedulingRule rule = new ObjectSchedulingRule(repository);
- try {
- Job.getJobManager().beginRule(rule, monitor);
-
- final Map<String, TaskRelation[]> relationsByTaskId = new HashMap<String, TaskRelation[]>();
- SynchronizationSession session = new SynchronizationSession(taskDataManager) {
- @Override
- public void putTaskData(ITask task, TaskData taskData) throws CoreException {
- boolean changed = connector.hasTaskChanged(repository, task, taskData);
- taskDataManager.putUpdatedTaskData(task, taskData, isUser(), this);
- if (taskData.isPartial()) {
- if (changed && connector.canSynchronizeTask(repository, task)) {
- markStale(task);
+ ObjectSchedulingRule rule = new ObjectSchedulingRule(repository);
+ try {
+ Job.getJobManager().beginRule(rule, monitor);
+
+ final Map<String, TaskRelation[]> relationsByTaskId = new HashMap<String, TaskRelation[]>();
+ SynchronizationSession session = new SynchronizationSession(taskDataManager) {
+ @Override
+ public void putTaskData(ITask task, TaskData taskData) throws CoreException {
+ boolean changed = connector.hasTaskChanged(repository, task, taskData);
+ taskDataManager.putUpdatedTaskData(task, taskData, isUser(), this);
+ if (taskData.isPartial()) {
+ if (changed && connector.canSynchronizeTask(repository, task)) {
+ markStale(task);
+ }
+ } else {
+ Collection<TaskRelation> relations = connector.getTaskRelations(taskData);
+ if (relations != null) {
+ relationsByTaskId.put(task.getTaskId(), relations.toArray(new TaskRelation[0]));
+ }
}
+ }
+ };
+ session.setTaskRepository(repository);
+ session.setFullSynchronization(isFullSynchronization());
+ session.setTasks(Collections.unmodifiableSet(allTasks));
+ session.setNeedsPerformQueries(true);
+ session.setUser(isUser());
+
+ updateQueryStatus(null);
+ try {
+ boolean success = preSynchronization(session, new SubProgressMonitor(monitor, 20));
+
+ if ((success && session.needsPerformQueries()) || isUser()) {
+ // synchronize queries, tasks changed within query are added to set of tasks to be synchronized
+ synchronizeQueries(monitor, session);
} else {
- Collection<TaskRelation> relations = connector.getTaskRelations(taskData);
- if (relations != null) {
- relationsByTaskId.put(task.getTaskId(), relations.toArray(new TaskRelation[0]));
- }
+ monitor.worked(queries.size() * 20);
+ }
+ } finally {
+ for (RepositoryQuery repositoryQuery : queries) {
+ repositoryQuery.setSynchronizing(false);
}
+ taskList.notifySynchronizationStateChanged(queries);
}
- };
- session.setTaskRepository(repository);
- session.setFullSynchronization(isFullSynchronization());
- session.setTasks(Collections.unmodifiableSet(allTasks));
- session.setNeedsPerformQueries(true);
- session.setUser(isUser());
-
- updateQueryStatus(null);
- try {
- boolean success = preSynchronization(session, new SubProgressMonitor(monitor, 20));
- if ((success && session.needsPerformQueries()) || isUser()) {
- // synchronize queries, tasks changed within query are added to set of tasks to be synchronized
- synchronizeQueries(monitor, session);
- } else {
- monitor.worked(queries.size() * 20);
+ Set<ITask> tasksToBeSynchronized = new HashSet<ITask>();
+ for (ITask task : session.getStaleTasks()) {
+ tasksToBeSynchronized.add(task);
+ ((AbstractTask) task).setSynchronizing(true);
}
- } finally {
- for (RepositoryQuery repositoryQuery : queries) {
- repositoryQuery.setSynchronizing(false);
- }
- taskList.notifySynchronizationStateChanged(queries);
- }
- Set<ITask> tasksToBeSynchronized = new HashSet<ITask>();
- for (ITask task : session.getStaleTasks()) {
- tasksToBeSynchronized.add(task);
- ((AbstractTask) task).setSynchronizing(true);
- }
-
- // synchronize tasks that were marked by the connector
- SynchronizeTasksJob job = new SynchronizeTasksJob(taskList, taskDataManager, tasksModel, connector,
- repository, tasksToBeSynchronized);
- job.setUser(isUser());
- job.setSession(session);
- if (!tasksToBeSynchronized.isEmpty()) {
- Policy.checkCanceled(monitor);
- IStatus result = job.run(new SubProgressMonitor(monitor, 30));
- if (result == Status.CANCEL_STATUS) {
- throw new OperationCanceledException();
+ // synchronize tasks that were marked by the connector
+ SynchronizeTasksJob job = new SynchronizeTasksJob(taskList, taskDataManager, tasksModel, connector,
+ repository, tasksToBeSynchronized);
+ job.setUser(isUser());
+ job.setSession(session);
+ if (!tasksToBeSynchronized.isEmpty()) {
+ Policy.checkCanceled(monitor);
+ IStatus result = job.run(new SubProgressMonitor(monitor, 30));
+ if (result == Status.CANCEL_STATUS) {
+ throw new OperationCanceledException();
+ }
+ statuses.addAll(job.getStatuses());
+ }
+ monitor.subTask(Messages.SynchronizeQueriesJob_Receiving_related_tasks);
+ job.synchronizedTaskRelations(monitor, relationsByTaskId);
+ monitor.worked(10);
+
+ session.setChangedTasks(tasksToBeSynchronized);
+ if (statuses.size() > 0) {
+ Status status = new MultiStatus(ITasksCoreConstants.ID_PLUGIN, 0,
+ statuses.toArray(new IStatus[0]), "Query synchronization failed", null); //$NON-NLS-1$
+ session.setStatus(status);
}
- statuses.addAll(job.getStatuses());
- }
- monitor.subTask(Messages.SynchronizeQueriesJob_Receiving_related_tasks);
- job.synchronizedTaskRelations(monitor, relationsByTaskId);
- monitor.worked(10);
-
- session.setChangedTasks(tasksToBeSynchronized);
- if (statuses.size() > 0) {
- Status status = new MultiStatus(ITasksCoreConstants.ID_PLUGIN, 0, statuses.toArray(new IStatus[0]),
- "Query synchronization failed", null); //$NON-NLS-1$
- session.setStatus(status);
- }
- // hook into the connector for synchronization time stamp management
- postSynchronization(session, new SubProgressMonitor(monitor, 10));
+ // hook into the connector for synchronization time stamp management
+ postSynchronization(session, new SubProgressMonitor(monitor, 10));
+ } finally {
+ Job.getJobManager().endRule(rule);
+ }
+ } catch (OperationCanceledException e) {
+ return Status.CANCEL_STATUS;
+ } catch (Exception e) {
+ StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, "Synchronization failed", e)); //$NON-NLS-1$
+ } catch (LinkageError e) {
+ StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, NLS.bind(
+ "Synchronization for connector ''{0}'' failed", connector.getConnectorKind()), e)); //$NON-NLS-1$
} finally {
- Job.getJobManager().endRule(rule);
+ monitor.done();
}
- } catch (OperationCanceledException e) {
- return Status.CANCEL_STATUS;
- } catch (Exception e) {
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, "Synchronization failed", e)); //$NON-NLS-1$
- } catch (LinkageError e) {
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, NLS.bind(
- "Synchronization for connector ''{0}'' failed", connector.getConnectorKind()), e)); //$NON-NLS-1$
} finally {
- monitor.done();
+ monitor.detach(jobMonitor);
}
return Status.OK_STATUS;
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizeRepositoriesJob.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizeRepositoriesJob.java
index 03444dbb8..163b17f10 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizeRepositoriesJob.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizeRepositoriesJob.java
@@ -81,69 +81,75 @@ public class SynchronizeRepositoriesJob extends SynchronizationJob {
@Override
public IStatus run(IProgressMonitor jobMonitor) {
- monitor.attach(jobMonitor);
- // get the current list of repositories
- Set<TaskRepository> repositories = this.repositories;
- if (repositories == null) {
- repositories = new HashSet<TaskRepository>(repositoryManager.getAllRepositories());
- }
try {
- monitor.beginTask(Messages.SynchronizeRepositoriesJob_Processing, repositories.size() * 100);
+ monitor.setCanceled(false);
+ monitor.attach(jobMonitor);
- if (TRACE_ENABLED) {
- trace("Starting repository synchronization"); //$NON-NLS-1$
+ // get the current list of repositories
+ Set<TaskRepository> repositories = this.repositories;
+ if (repositories == null) {
+ repositories = new HashSet<TaskRepository>(repositoryManager.getAllRepositories());
}
- for (TaskRepository repository : repositories) {
- if (monitor.isCanceled()) {
- return Status.CANCEL_STATUS;
+ try {
+ monitor.beginTask(Messages.SynchronizeRepositoriesJob_Processing, repositories.size() * 100);
+
+ if (TRACE_ENABLED) {
+ trace("Starting repository synchronization"); //$NON-NLS-1$
}
+ for (TaskRepository repository : repositories) {
+ if (monitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
- if (repository.isOffline()) {
- if (TRACE_ENABLED) {
- trace("Skipping synchronization for " + repository.getRepositoryLabel()); //$NON-NLS-1$
+ if (repository.isOffline()) {
+ if (TRACE_ENABLED) {
+ trace("Skipping synchronization for " + repository.getRepositoryLabel()); //$NON-NLS-1$
+ }
+ monitor.worked(100);
+ continue;
}
- monitor.worked(100);
- continue;
- }
- monitor.setTaskName(MessageFormat.format(Messages.SynchronizeRepositoriesJob_Processing_,
- repository.getRepositoryLabel()));
-
- final AbstractRepositoryConnector connector = repositoryManager.getRepositoryConnector(repository.getConnectorKind());
- Set<RepositoryQuery> queries = new HashSet<RepositoryQuery>(
- taskList.getRepositoryQueries(repository.getRepositoryUrl()));
- // remove queries that are not configured for auto update
- if (!isUser()) {
- for (Iterator<RepositoryQuery> it = queries.iterator(); it.hasNext();) {
- if (!it.next().getAutoUpdate()) {
- it.remove();
+ monitor.setTaskName(MessageFormat.format(Messages.SynchronizeRepositoriesJob_Processing_,
+ repository.getRepositoryLabel()));
+
+ final AbstractRepositoryConnector connector = repositoryManager.getRepositoryConnector(repository.getConnectorKind());
+ Set<RepositoryQuery> queries = new HashSet<RepositoryQuery>(
+ taskList.getRepositoryQueries(repository.getRepositoryUrl()));
+ // remove queries that are not configured for auto update
+ if (!isUser()) {
+ for (Iterator<RepositoryQuery> it = queries.iterator(); it.hasNext();) {
+ if (!it.next().getAutoUpdate()) {
+ it.remove();
+ }
}
}
- }
- if (isUser() || queries.isEmpty()) {
- monitor.worked(20);
- } else {
- // occasionally request update of repository configuration attributes as part of background synchronizations
- updateRepositoryConfiguration(repository, connector, new SubProgressMonitor(monitor, 20));
- }
+ if (isUser() || queries.isEmpty()) {
+ monitor.worked(20);
+ } else {
+ // occasionally request update of repository configuration attributes as part of background synchronizations
+ updateRepositoryConfiguration(repository, connector, new SubProgressMonitor(monitor, 20));
+ }
+ if (TRACE_ENABLED) {
+ trace("Synchronizing queries for " + repository.getRepositoryLabel()); //$NON-NLS-1$
+ }
+ updateQueries(repository, connector, queries, monitor);
+ }
if (TRACE_ENABLED) {
- trace("Synchronizing queries for " + repository.getRepositoryLabel()); //$NON-NLS-1$
+ trace("Completed repository synchronization"); //$NON-NLS-1$
}
- updateQueries(repository, connector, queries, monitor);
- }
- if (TRACE_ENABLED) {
- trace("Completed repository synchronization"); //$NON-NLS-1$
- }
- // it's better to remove the job from the progress view instead of having it blocked until all child jobs finish
+ // it's better to remove the job from the progress view instead of having it blocked until all child jobs finish
// if (isUser()) {
// Job.getJobManager().join(family, monitor);
// }
- } catch (OperationCanceledException e) {
- return Status.CANCEL_STATUS;
+ } catch (OperationCanceledException e) {
+ return Status.CANCEL_STATUS;
+ } finally {
+ monitor.done();
+ }
} finally {
- monitor.done();
+ monitor.detach(jobMonitor);
}
return Status.OK_STATUS;
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizeTasksJob.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizeTasksJob.java
index c6482d534..1bdf43b3a 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizeTasksJob.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizeTasksJob.java
@@ -100,43 +100,48 @@ public class SynchronizeTasksJob extends SynchronizationJob {
@Override
public IStatus run(IProgressMonitor jobMonitor) {
- monitor.attach(jobMonitor);
try {
- if (taskRepository == null) {
- try {
- monitor.beginTask(Messages.SynchronizeTasksJob_Processing, allTasks.size() * 100);
- // group tasks by repository
- Map<TaskRepository, Set<ITask>> tasksByRepository = new HashMap<TaskRepository, Set<ITask>>();
- for (ITask task : allTasks) {
- TaskRepository repository = repositoryManager.getRepository(task.getConnectorKind(),
- task.getRepositoryUrl());
- Set<ITask> tasks = tasksByRepository.get(repository);
- if (tasks == null) {
- tasks = new HashSet<ITask>();
- tasksByRepository.put(repository, tasks);
+ monitor.setCanceled(false);
+ monitor.attach(jobMonitor);
+ try {
+ if (taskRepository == null) {
+ try {
+ monitor.beginTask(Messages.SynchronizeTasksJob_Processing, allTasks.size() * 100);
+ // group tasks by repository
+ Map<TaskRepository, Set<ITask>> tasksByRepository = new HashMap<TaskRepository, Set<ITask>>();
+ for (ITask task : allTasks) {
+ TaskRepository repository = repositoryManager.getRepository(task.getConnectorKind(),
+ task.getRepositoryUrl());
+ Set<ITask> tasks = tasksByRepository.get(repository);
+ if (tasks == null) {
+ tasks = new HashSet<ITask>();
+ tasksByRepository.put(repository, tasks);
+ }
+ tasks.add(task);
}
- tasks.add(task);
- }
- // synchronize tasks for each repositories
- for (TaskRepository taskRepository : tasksByRepository.keySet()) {
- setName(MessageFormat.format(Messages.SynchronizeTasksJob_Synchronizing_Tasks__X_,
- taskRepository.getRepositoryLabel()));
- this.taskRepository = taskRepository;
- Set<ITask> repositoryTasks = tasksByRepository.get(taskRepository);
- run(repositoryTasks, new SubProgressMonitor(monitor, repositoryTasks.size() * 100));
+ // synchronize tasks for each repositories
+ for (TaskRepository taskRepository : tasksByRepository.keySet()) {
+ setName(MessageFormat.format(Messages.SynchronizeTasksJob_Synchronizing_Tasks__X_,
+ taskRepository.getRepositoryLabel()));
+ this.taskRepository = taskRepository;
+ Set<ITask> repositoryTasks = tasksByRepository.get(taskRepository);
+ run(repositoryTasks, new SubProgressMonitor(monitor, repositoryTasks.size() * 100));
+ }
+ } finally {
+ monitor.done();
}
- } finally {
- monitor.done();
+ } else {
+ run(allTasks, monitor);
}
- } else {
- run(allTasks, monitor);
- }
- } catch (OperationCanceledException e) {
- for (ITask task : allTasks) {
- ((AbstractTask) task).setSynchronizing(false);
- taskList.notifyElementChanged(task);
+ } catch (OperationCanceledException e) {
+ for (ITask task : allTasks) {
+ ((AbstractTask) task).setSynchronizing(false);
+ taskList.notifyElementChanged(task);
+ }
+ return Status.CANCEL_STATUS;
}
- return Status.CANCEL_STATUS;
+ } finally {
+ monitor.detach(jobMonitor);
}
return Status.OK_STATUS;
}

Back to the top