Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Davis2014-04-30 19:28:14 -0400
committerSam Davis2014-05-08 16:19:54 -0400
commitdc89720c44f6cfcd6e127bc0fad5c2da9cb965d0 (patch)
tree83108c77b6283b7c6e244822e7f319fc49fcf816 /org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal
parent5fa632424ac4a18d6ccf0cbfa806127d36e902a3 (diff)
downloadorg.eclipse.mylyn.tasks-dc89720c44f6cfcd6e127bc0fad5c2da9cb965d0.tar.gz
org.eclipse.mylyn.tasks-dc89720c44f6cfcd6e127bc0fad5c2da9cb965d0.tar.xz
org.eclipse.mylyn.tasks-dc89720c44f6cfcd6e127bc0fad5c2da9cb965d0.zip
385670: allow connector clients to choose whether subtasks
should be returned by queries Change-Id: I796006923fe6c61f6eb9f290d08452fe67348ef6 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=385670
Diffstat (limited to 'org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal')
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ITaskJobFactory.java10
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskJobFactory.java14
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizeQueriesJob.java1
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizeRepositoriesJob.java1
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizeTasksJob.java24
5 files changed, 38 insertions, 12 deletions
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ITaskJobFactory.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ITaskJobFactory.java
index 1966cf663..d9d714f7b 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ITaskJobFactory.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ITaskJobFactory.java
@@ -51,4 +51,14 @@ public interface ITaskJobFactory {
TaskRepository taskRepository, ITask task, AbstractTaskAttachmentSource source, String comment,
TaskAttribute attachmentAttribute);
+ /**
+ * Specify whether subtasks should be fetched as part of task synchronization. Defaults to true.
+ */
+ public void setFetchSubtasks(boolean fetchSubtasks);
+
+ /**
+ * @return whether subtasks should be fetched as part of task synchronization
+ */
+ public boolean getFetchSubtasks();
+
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskJobFactory.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskJobFactory.java
index c99315d0c..3fbab5c51 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskJobFactory.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskJobFactory.java
@@ -66,6 +66,8 @@ public class TaskJobFactory implements ITaskJobFactory {
private final IRepositoryModel tasksModel;
+ private boolean fetchSubtasks = true;
+
protected static synchronized List<TaskJobListener> getTaskJobListeners(AbstractRepositoryConnector connector) {
if (taskJobListeners == null) {
taskJobListeners = new HashMap<String, List<TaskJobListener>>();
@@ -101,6 +103,7 @@ public class TaskJobFactory implements ITaskJobFactory {
public SynchronizationJob createSynchronizeTasksJob(AbstractRepositoryConnector connector, Set<ITask> tasks) {
SynchronizeTasksJob job = new SynchronizeTasksJob(taskList, taskDataManager, tasksModel, connector,
repositoryManager, tasks);
+ job.setFetchSubtasks(fetchSubtasks);
job.setPriority(Job.LONG);
return job;
}
@@ -109,6 +112,7 @@ public class TaskJobFactory implements ITaskJobFactory {
TaskRepository taskRepository, Set<ITask> tasks) {
SynchronizeTasksJob job = new SynchronizeTasksJob(taskList, taskDataManager, tasksModel, connector,
taskRepository, tasks);
+ job.setFetchSubtasks(fetchSubtasks);
job.setPriority(Job.LONG);
return job;
}
@@ -117,6 +121,7 @@ public class TaskJobFactory implements ITaskJobFactory {
TaskRepository repository, Set<RepositoryQuery> queries) {
SynchronizationJob job = new SynchronizeQueriesJob(taskList, taskDataManager, tasksModel, connector,
repository, queries);
+ job.setFetchSubtasks(fetchSubtasks);
job.setPriority(Job.DECORATE);
return job;
}
@@ -124,6 +129,7 @@ public class TaskJobFactory implements ITaskJobFactory {
public SynchronizationJob createSynchronizeRepositoriesJob(Set<TaskRepository> repositories) {
SynchronizeRepositoriesJob job = new SynchronizeRepositoriesJob(taskList, taskDataManager, tasksModel,
repositoryManager);
+ job.setFetchSubtasks(fetchSubtasks);
job.setRepositories(repositories);
job.setPriority(Job.DECORATE);
job.addJobChangeListener(new JobChangeAdapter() {
@@ -191,4 +197,12 @@ public class TaskJobFactory implements ITaskJobFactory {
job.setUser(true);
return job;
}
+
+ public void setFetchSubtasks(boolean fetchSubtasks) {
+ this.fetchSubtasks = fetchSubtasks;
+ }
+
+ public boolean getFetchSubtasks() {
+ return fetchSubtasks;
+ }
}
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 c5ff6d12e..6902f098b 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
@@ -218,6 +218,7 @@ public class SynchronizeQueriesJob extends SynchronizationJob {
// synchronize tasks that were marked by the connector
SynchronizeTasksJob job = new SynchronizeTasksJob(taskList, taskDataManager, tasksModel, connector,
repository, tasksToBeSynchronized);
+ job.setFetchSubtasks(getFetchSubtasks());
job.setUser(isUser());
job.setSession(session);
if (!tasksToBeSynchronized.isEmpty()) {
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 42108e16c..03c445a03 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
@@ -175,6 +175,7 @@ public class SynchronizeRepositoriesJob extends SynchronizationJob {
return ITasksCoreConstants.JOB_FAMILY_SYNCHRONIZATION == family;
}
};
+ job.setFetchSubtasks(getFetchSubtasks());
job.setUser(isUser());
job.setFullSynchronization(true);
job.setPriority(Job.DECORATE);
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 bee3c788f..5ced40cee 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
@@ -46,8 +46,6 @@ import org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler;
import org.eclipse.mylyn.tasks.core.data.TaskData;
import org.eclipse.mylyn.tasks.core.data.TaskDataCollector;
import org.eclipse.mylyn.tasks.core.data.TaskRelation;
-import org.eclipse.mylyn.tasks.core.data.TaskRelation.Direction;
-import org.eclipse.mylyn.tasks.core.data.TaskRelation.Kind;
import org.eclipse.mylyn.tasks.core.sync.SynchronizationJob;
import org.eclipse.osgi.util.NLS;
@@ -163,18 +161,20 @@ public class SynchronizeTasksJob extends SynchronizationJob {
TaskRelation[] relations = relationsByTaskId.get(taskId);
for (TaskRelation relation : relations) {
- if (relation.getDirection() == Direction.OUTWARD && relation.getKind() == Kind.CONTAINMENT) {
+ if (relation.isChildRelation()) {
ITask task = taskList.getTask(taskRepository.getRepositoryUrl(), relation.getTaskId());
if (task == null) {
- try {
- task = synchronizeTask(monitor, relation.getTaskId());
- } catch (CoreException e) {
- String taskKey = (task != null && task.getTaskKey() != null)
- ? task.getTaskKey()
- : relation.getTaskId();
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, NLS.bind(
- Messages.SynchronizeTasksJob_Synchronization_of_task_ID_REPOSITORY_failed,
- taskKey, taskRepository.getRepositoryLabel()), e));
+ if (getFetchSubtasks()) {
+ try {
+ task = synchronizeTask(monitor, relation.getTaskId());
+ } catch (CoreException e) {
+ StatusHandler.log(new Status(
+ IStatus.ERROR,
+ ITasksCoreConstants.ID_PLUGIN,
+ NLS.bind(
+ Messages.SynchronizeTasksJob_Synchronization_of_task_ID_REPOSITORY_failed,
+ relation.getTaskId(), taskRepository.getRepositoryLabel()), e));
+ }
}
} else {
removedChildTasks.remove(task);

Back to the top