summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLily Guo2013-05-27 18:34:58 (EDT)
committer Gerrit Code Review @ Eclipse.org2013-06-19 16:21:02 (EDT)
commit95afdebedf23d9d21d367c66a3b93cab007ec5f9 (patch)
tree85932e518fb8e59c395da299b91e291136ab96e4
parent6f0c2e375e7b0322515cd29a4de2e236fe9884ee (diff)
downloadorg.eclipse.mylyn.tasks-95afdebedf23d9d21d367c66a3b93cab007ec5f9.zip
org.eclipse.mylyn.tasks-95afdebedf23d9d21d367c66a3b93cab007ec5f9.tar.gz
org.eclipse.mylyn.tasks-95afdebedf23d9d21d367c66a3b93cab007ec5f9.tar.bz2
409758: [api] allow clients to determine the first and last activityrefs/changes/49/13249/9
dates of a task Change-Id: I5aa8aa53d204a3c6cef2fc4cfa7d4023f72c719a Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=409758
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskActivityManager.java16
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskActivityManager.java13
2 files changed, 29 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskActivityManager.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskActivityManager.java
index b4c77a4..51804d8 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskActivityManager.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskActivityManager.java
@@ -857,6 +857,22 @@ public class TaskActivityManager implements ITaskActivityManager {
return taskActivationHistory;
}
+ public Date getFirstActivity(ITask task) {
+ SortedMap<Calendar, Long> activityMap = taskElapsedTimeMap.get(task);
+ if (activityMap != null && !activityMap.isEmpty()) {
+ return activityMap.firstKey().getTime();
+ }
+ return null;
+ }
+
+ public Date getLastActivity(ITask task) {
+ SortedMap<Calendar, Long> activityMap = taskElapsedTimeMap.get(task);
+ if (activityMap != null && !activityMap.isEmpty()) {
+ return activityMap.lastKey().getTime();
+ }
+ return null;
+ }
+
public Set<ITask> getAllScheduledTasks() {
return new HashSet<ITask>(allScheduledTasks);
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskActivityManager.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskActivityManager.java
index 02dd0ca..d60bef7 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskActivityManager.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskActivityManager.java
@@ -12,6 +12,7 @@
package org.eclipse.mylyn.tasks.core;
import java.util.Calendar;
+import java.util.Date;
import java.util.Set;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
@@ -68,6 +69,18 @@ public interface ITaskActivityManager {
*/
public abstract long getElapsedTime(ITask task, Calendar start, Calendar end);
+ /**
+ * @return the date of the first activity of the given task
+ * @since 3.10
+ */
+ public abstract Date getFirstActivity(ITask task);
+
+ /**
+ * @return the date of the last activity of the given task
+ * @since 3.10
+ */
+ public abstract Date getLastActivity(ITask task);
+
public abstract void addActivityListener(ITaskActivityListener listener);
public abstract void removeActivityListener(ITaskActivityListener listener);