summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Zarna2013-04-03 11:47:43 (EDT)
committer Gerrit Code Review @ Eclipse.org2013-04-04 17:29:56 (EDT)
commit2cd3cb02b81a47fb1bd13064ac2aa5280fe37771 (patch)
tree5c761315579bbdd86e41db3ba2be616a8bd80008
parentf347119a4bf8b66da847fe33b6cf876ca0589d65 (diff)
downloadorg.eclipse.mylyn.tasks-2cd3cb02b81a47fb1bd13064ac2aa5280fe37771.zip
org.eclipse.mylyn.tasks-2cd3cb02b81a47fb1bd13064ac2aa5280fe37771.tar.gz
org.eclipse.mylyn.tasks-2cd3cb02b81a47fb1bd13064ac2aa5280fe37771.tar.bz2
404857: allow background submissions of tasks and attachmentsrefs/changes/24/11624/4
Change-Id: If8e2cf914dd05fc6ebc674dd5961a1075a77be63 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=404857
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SubmitTaskAttachmentJob.java6
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SubmitTaskJob.java6
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/sync/SubmitJob.java10
3 files changed, 14 insertions, 8 deletions
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SubmitTaskAttachmentJob.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SubmitTaskAttachmentJob.java
index ba09383..04e8406 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SubmitTaskAttachmentJob.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SubmitTaskAttachmentJob.java
@@ -16,7 +16,6 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
-import org.eclipse.mylyn.commons.net.Policy;
import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants.MutexSchedulingRule;
import org.eclipse.mylyn.internal.tasks.core.data.TaskDataManager;
@@ -93,11 +92,10 @@ public class SubmitTaskAttachmentJob extends SubmitJob {
2 * (1 + getSubmitJobListeners().length) * 100);
monitor.subTask(Messages.SubmitTaskAttachmentJob_Sending_data);
attachmentHandler.postContent(taskRepository, task, source, comment, attachmentAttribute,
- Policy.subMonitorFor(monitor, 100));
+ subMonitorFor(monitor, 100));
fireTaskSubmitted(monitor);
monitor.subTask(Messages.SubmitTaskAttachmentJob_Updating_task);
- TaskData taskData = connector.getTaskData(taskRepository, task.getTaskId(),
- Policy.subMonitorFor(monitor, 100));
+ TaskData taskData = connector.getTaskData(taskRepository, task.getTaskId(), subMonitorFor(monitor, 100));
taskDataManager.putUpdatedTaskData(task, taskData, true);
fireTaskSynchronized(monitor);
} catch (CoreException e) {
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 102fca9..a556525 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
@@ -23,7 +23,6 @@ import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.core.runtime.Status;
import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.commons.net.Policy;
import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants.MutexSchedulingRule;
import org.eclipse.mylyn.internal.tasks.core.TaskTask;
@@ -99,7 +98,7 @@ public class SubmitTaskJob extends SubmitJob {
AbstractTaskDataHandler taskDataHandler = connector.getTaskDataHandler();
monitor.subTask(Messages.SubmitTaskJob_Sending_data);
response = taskDataHandler.postTaskData(taskRepository, taskData, oldAttributes,
- Policy.subMonitorFor(monitor, 100));
+ subMonitorFor(monitor, 100));
if (response == null || response.getTaskId() == null) {
throw new CoreException(new RepositoryStatus(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN,
RepositoryStatus.ERROR_INTERNAL,
@@ -110,8 +109,7 @@ public class SubmitTaskJob extends SubmitJob {
// 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));
+ TaskData updatedTaskData = connector.getTaskData(taskRepository, taskId, subMonitorFor(monitor, 100));
task = createTask(monitor, updatedTaskData);
taskDataManager.putSubmittedTaskData(task, updatedTaskData, monitor);
fireTaskSynchronized(monitor);
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/sync/SubmitJob.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/sync/SubmitJob.java
index 594c9cd..5ecc6c4 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/sync/SubmitJob.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/sync/SubmitJob.java
@@ -124,4 +124,14 @@ public abstract class SubmitJob extends TaskJob {
*/
public abstract RepositoryResponse getResponse();
+ /**
+ * @since 3.9
+ */
+ protected IProgressMonitor subMonitorFor(IProgressMonitor monitor, int ticks) {
+ if (!isUser()) {
+ return Policy.backgroundMonitorFor(monitor);
+ }
+ return Policy.subMonitorFor(monitor, ticks);
+ }
+
}