Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEndre Zoltan Kovacs2014-01-10 11:34:15 -0500
committerSam Davis2014-03-03 21:42:51 -0500
commit4f9f3b4de425fb513b84b4c6e8bdfa367351b854 (patch)
tree113f97e80c1bc1720683b52334c954491db4a6a7
parent2d0cefb8316d2b0f37474d799c9182b494244cc6 (diff)
downloadorg.eclipse.mylyn.tasks-4f9f3b4de425fb513b84b4c6e8bdfa367351b854.tar.gz
org.eclipse.mylyn.tasks-4f9f3b4de425fb513b84b4c6e8bdfa367351b854.tar.xz
org.eclipse.mylyn.tasks-4f9f3b4de425fb513b84b4c6e8bdfa367351b854.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