Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEndre Zoltan Kovacs2014-01-10 16:34:15 +0000
committerGerrit Code Review @ Eclipse.org2014-02-28 19:11:36 +0000
commit5bf7cf4a12d46f4de2326b00b6f091147f1e757a (patch)
tree69397a8a6ed1496aa7ffd81c56804a383aa45c3e
parent2f61bb77e60aa409f3c923956641582ce1661677 (diff)
downloadorg.eclipse.mylyn.tasks-5bf7cf4a12d46f4de2326b00b6f091147f1e757a.tar.gz
org.eclipse.mylyn.tasks-5bf7cf4a12d46f4de2326b00b6f091147f1e757a.tar.xz
org.eclipse.mylyn.tasks-5bf7cf4a12d46f4de2326b00b6f091147f1e757a.zip
390529: [api] make taskData available in TaskJobListener methods
Bug: 390529 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=390529 Expanding the API of TaskJobEvent with TaskData. TaskData is now available for TaskJobListeners before and after the task is submitted. Change-Id: I67c2d79d5a0c4d6770a9c4c9557a86ea150b142b Signed-off-by: Endre Zoltan Kovacs <ekovacs@b2international.com>
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SubmitTaskJob.java9
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskJobEvent.java23
2 files changed, 28 insertions, 4 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 a556525f5..d3f316f0d 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Tasktop Technologies - initial API and implementation
+ * Endre Zoltan Kovacs - Supplying {@link TaskData} to {@link TaskJobEvent}s.
*******************************************************************************/
package org.eclipse.mylyn.internal.tasks.core.sync;
@@ -113,7 +114,7 @@ public class SubmitTaskJob extends SubmitJob {
task = createTask(monitor, updatedTaskData);
taskDataManager.putSubmittedTaskData(task, updatedTaskData, monitor);
fireTaskSynchronized(monitor);
- fireTaskSubmissionComplete();
+ fireTaskSubmissionComplete(updatedTaskData);
} catch (CoreException e) {
errorStatus = e.getStatus();
} catch (OperationCanceledException e) {
@@ -137,7 +138,7 @@ public class SubmitTaskJob extends SubmitJob {
for (final TaskJobListener listener : taskJobListeners) {
SafeRunner.run(new ISafeRunnable() {
public void run() throws Exception {
- listener.aboutToSubmit(new TaskJobEvent(originalTask, task));
+ listener.aboutToSubmit(new TaskJobEvent(originalTask, task, taskData));
}
public void handleException(Throwable e) {
@@ -148,11 +149,11 @@ public class SubmitTaskJob extends SubmitJob {
}
}
- protected void fireTaskSubmissionComplete() {
+ protected void fireTaskSubmissionComplete(final TaskData updatedTaskData) {
for (final TaskJobListener listener : taskJobListeners) {
SafeRunner.run(new ISafeRunnable() {
public void run() throws Exception {
- listener.taskSubmitted(new TaskJobEvent(originalTask, task));
+ listener.taskSubmitted(new TaskJobEvent(originalTask, task, updatedTaskData));
}
public void handleException(Throwable e) {
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskJobEvent.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskJobEvent.java
index 27c1b147d..7fbc81790 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskJobEvent.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskJobEvent.java
@@ -7,10 +7,14 @@
*
* Contributors:
* Tasktop Technologies - initial API and implementation
+ * Endre Zoltan Kovacs - adding {@link TaskData} to the API.
*******************************************************************************/
package org.eclipse.mylyn.tasks.core;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.mylyn.tasks.core.data.TaskData;
+
/**
* @author Sam Davis
* @since 3.7
@@ -21,9 +25,19 @@ public class TaskJobEvent {
private final ITask originalTask;
+ private final TaskData taskData;
+
public TaskJobEvent(ITask originalTask, ITask task) {
+ this(originalTask, task, null);
+ }
+
+ /**
+ * @since 3.11
+ */
+ public TaskJobEvent(final ITask originalTask, final ITask task, @Nullable final TaskData taskData) {
this.originalTask = originalTask;
this.task = task;
+ this.taskData = taskData;
}
/**
@@ -41,4 +55,13 @@ public class TaskJobEvent {
return task;
}
+ /**
+ * @return The taskData of the task being submitted. On 'aboutTosubmit', it holds the unsubmitted taskData, on
+ * 'taskSubmitted' it is the updated taskData. May be <code>null</code>.
+ * @since 3.11
+ */
+ public TaskData getTaskData() {
+ return taskData;
+ }
+
}

Back to the top