Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2009-07-21 18:52:06 -0400
committerspingel2009-07-21 18:52:06 -0400
commit60cd5f68b7e649c993dccceaf5282abf858a3fe4 (patch)
tree7d485256925e8a81f5ef598bffd9267f58db36f2 /org.eclipse.mylyn.tasks.core
parent35d02b17562a6c7fd390b84c1c734e01f9cfce5f (diff)
downloadorg.eclipse.mylyn.tasks-60cd5f68b7e649c993dccceaf5282abf858a3fe4.tar.gz
org.eclipse.mylyn.tasks-60cd5f68b7e649c993dccceaf5282abf858a3fe4.tar.xz
org.eclipse.mylyn.tasks-60cd5f68b7e649c993dccceaf5282abf858a3fe4.zip
NEW - bug 284172: [patch] provide access to progress monitor to allow monitoring synchronizationJob in progress
https://bugs.eclipse.org/bugs/show_bug.cgi?id=284172
Diffstat (limited to 'org.eclipse.mylyn.tasks.core')
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizeQueriesJob.java11
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizeRepositoriesJob.java12
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizeTasksJob.java14
3 files changed, 33 insertions, 4 deletions
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 38baaf427..edb65cc5f 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
@@ -31,6 +31,8 @@ import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.mylyn.commons.core.DelegatingProgressMonitor;
+import org.eclipse.mylyn.commons.core.IDelegatingProgressMonitor;
import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.commons.net.Policy;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
@@ -120,6 +122,8 @@ public class SynchronizeQueriesJob extends SynchronizationJob {
private final List<IStatus> statuses;
+ private final IDelegatingProgressMonitor monitor;
+
public SynchronizeQueriesJob(TaskList taskList, TaskDataManager taskDataManager, IRepositoryModel tasksModel,
AbstractRepositoryConnector connector, TaskRepository repository, Set<RepositoryQuery> queries) {
super(Messages.SynchronizeQueriesJob_Synchronizing_Queries + " (" + repository.getRepositoryLabel() + ")"); //$NON-NLS-1$//$NON-NLS-2$
@@ -130,10 +134,12 @@ public class SynchronizeQueriesJob extends SynchronizationJob {
this.repository = repository;
this.queries = queries;
this.statuses = new ArrayList<IStatus>();
+ this.monitor = new DelegatingProgressMonitor();
}
@Override
- public IStatus run(IProgressMonitor monitor) {
+ public IStatus run(IProgressMonitor jobMonitor) {
+ monitor.attach(jobMonitor);
try {
monitor.beginTask(Messages.SynchronizeQueriesJob_Processing, 20 + queries.size() * 20 + 40 + 10);
@@ -319,4 +325,7 @@ public class SynchronizeQueriesJob extends SynchronizationJob {
return Collections.unmodifiableCollection(statuses);
}
+ public IDelegatingProgressMonitor getMonitor() {
+ return monitor;
+ }
}
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 bc0adfff8..01005e911 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
@@ -25,6 +25,8 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.mylyn.commons.core.DelegatingProgressMonitor;
+import org.eclipse.mylyn.commons.core.IDelegatingProgressMonitor;
import org.eclipse.mylyn.commons.net.Policy;
import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
@@ -53,6 +55,8 @@ public class SynchronizeRepositoriesJob extends SynchronizationJob {
private final IRepositoryModel tasksModel;
+ private final IDelegatingProgressMonitor monitor;
+
public SynchronizeRepositoriesJob(TaskList taskList, TaskDataManager taskDataManager, IRepositoryModel tasksModel,
IRepositoryManager repositoryManager) {
super(Messages.SynchronizeRepositoriesJob_Synchronizing_Task_List);
@@ -60,6 +64,7 @@ public class SynchronizeRepositoriesJob extends SynchronizationJob {
this.taskDataManager = taskDataManager;
this.tasksModel = tasksModel;
this.repositoryManager = repositoryManager;
+ this.monitor = new DelegatingProgressMonitor();
}
public Collection<TaskRepository> getRepositories() {
@@ -75,7 +80,8 @@ public class SynchronizeRepositoriesJob extends SynchronizationJob {
}
@Override
- public IStatus run(IProgressMonitor monitor) {
+ public IStatus run(IProgressMonitor jobMonitor) {
+ monitor.attach(jobMonitor);
// get the current list of repositories
Set<TaskRepository> repositories = this.repositories;
if (repositories == null) {
@@ -182,4 +188,8 @@ public class SynchronizeRepositoriesJob extends SynchronizationJob {
monitor.done();
}
}
+
+ public IDelegatingProgressMonitor getMonitor() {
+ return monitor;
+ }
}
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 ae5551370..661567881 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
@@ -27,6 +27,8 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.mylyn.commons.core.DelegatingProgressMonitor;
+import org.eclipse.mylyn.commons.core.IDelegatingProgressMonitor;
import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.commons.net.Policy;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
@@ -79,6 +81,8 @@ public class SynchronizeTasksJob extends SynchronizationJob {
private final List<IStatus> statuses;
+ private final IDelegatingProgressMonitor monitor;
+
public SynchronizeTasksJob(TaskList taskList, TaskDataManager synchronizationManager, IRepositoryModel tasksModel,
AbstractRepositoryConnector connector, TaskRepository taskRepository, Set<ITask> tasks) {
this(taskList, synchronizationManager, tasksModel, connector, (IRepositoryManager) null, tasks);
@@ -96,10 +100,12 @@ public class SynchronizeTasksJob extends SynchronizationJob {
this.allTasks = tasks;
this.statuses = new ArrayList<IStatus>();
setRule(new MutexSchedulingRule());
+ this.monitor = new DelegatingProgressMonitor();
}
@Override
- public IStatus run(IProgressMonitor monitor) {
+ public IStatus run(IProgressMonitor jobMonitor) {
+ monitor.attach(jobMonitor);
try {
if (taskRepository == null) {
try {
@@ -147,7 +153,8 @@ public class SynchronizeTasksJob extends SynchronizationJob {
synchronizedTaskRelations(monitor, relationsByTaskId);
}
- public void synchronizedTaskRelations(IProgressMonitor monitor, Map<String, TaskRelation[]> relationsByTaskId) {
+ public void synchronizedTaskRelations(IProgressMonitor jobMonitor, Map<String, TaskRelation[]> relationsByTaskId) {
+ monitor.attach(jobMonitor);
updateRelations = false;
for (String taskId : relationsByTaskId.keySet()) {
ITask parentTask = taskList.getTask(taskRepository.getRepositoryUrl(), taskId);
@@ -327,4 +334,7 @@ public class SynchronizeTasksJob extends SynchronizationJob {
return Collections.unmodifiableCollection(statuses);
}
+ public IDelegatingProgressMonitor getMonitor() {
+ return monitor;
+ }
}

Back to the top