Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrelves2009-03-10 20:12:44 -0400
committerrelves2009-03-10 20:12:44 -0400
commit343807d3b7a50dc5f5e5ad450528a1d92b632876 (patch)
tree7cb691824ebb9bbd2e18265f00c5e634b89180c4
parent3ad8a758fa260a6b20bf4a59cd193740b3127078 (diff)
downloadorg.eclipse.mylyn.tasks-343807d3b7a50dc5f5e5ad450528a1d92b632876.tar.gz
org.eclipse.mylyn.tasks-343807d3b7a50dc5f5e5ad450528a1d92b632876.tar.xz
org.eclipse.mylyn.tasks-343807d3b7a50dc5f5e5ad450528a1d92b632876.zip
NEW - bug 264254: [patch] Bug scheduled for a day 14 days in the future does not show in "Scheduled" Task list
https://bugs.eclipse.org/bugs/show_bug.cgi?id=264254
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskActivityManager.java15
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskActivityManagerTest.java27
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ScheduleTaskMenuContributor.java12
3 files changed, 49 insertions, 5 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 61efae1cf..ffc37c1a2 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
@@ -331,6 +331,9 @@ public class TaskActivityManager implements ITaskActivityManager {
} else if (!(range instanceof WeekDateRange)) {
return getScheduledTasks(range.getStartDate(), range.getEndDate());
}
+ if (range instanceof WeekDateRange && TaskActivityUtil.getNextWeek().next().compareTo(range) == 0) {
+ resultingTasks.addAll(getScheduledTasks(range.getStartDate(), range.getEndDate()));
+ }
}
return resultingTasks;
}
@@ -339,10 +342,16 @@ public class TaskActivityManager implements ITaskActivityManager {
Set<ITask> resultingTasks = new HashSet<ITask>();
synchronized (scheduledTasks) {
DateRange startRange = new DateRange(start);
- DateRange endRange = new DateRange(end);
+ Calendar endExclusive = TaskActivityUtil.getCalendar();
+ endExclusive.setTimeInMillis(end.getTimeInMillis() + 1);
+ DateRange endRange = new DateRange(endExclusive);
+
SortedMap<DateRange, Set<ITask>> result = scheduledTasks.subMap(startRange, endRange);
- for (Set<ITask> set : result.values()) {
- resultingTasks.addAll(set);
+ for (DateRange range : result.keySet()) {
+ if (start.compareTo(range.getStartDate()) > 0 || end.compareTo(range.getEndDate()) < 0) {
+ continue;
+ }
+ resultingTasks.addAll(result.get(range));
}
}
return resultingTasks;
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskActivityManagerTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskActivityManagerTest.java
index 19220308b..239952a2a 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskActivityManagerTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskActivityManagerTest.java
@@ -19,6 +19,7 @@ import junit.framework.TestCase;
import org.eclipse.mylyn.commons.net.AuthenticationCredentials;
import org.eclipse.mylyn.commons.net.AuthenticationType;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
+import org.eclipse.mylyn.internal.tasks.core.DateRange;
import org.eclipse.mylyn.internal.tasks.core.LocalTask;
import org.eclipse.mylyn.internal.tasks.core.TaskActivityManager;
import org.eclipse.mylyn.internal.tasks.core.TaskActivityUtil;
@@ -99,6 +100,32 @@ public class TaskActivityManagerTest extends TestCase {
TasksUiPlugin.getRepositoryManager().addRepository(repository);
}
+ public void testWeekEnd() {
+ AbstractTask task = new LocalTask("12", "task-12");
+ assertFalse(taskActivityManager.isScheduledForToday(task));
+
+ // test end of next week
+ Calendar end = TaskActivityUtil.getNextWeek().getEndDate();
+ Calendar start = TaskActivityUtil.getCalendar();
+ start.setTimeInMillis(end.getTimeInMillis());
+ TaskActivityUtil.snapStartOfDay(start);
+ taskActivityManager.setScheduledFor(task, new DateRange(start, end));
+ assertTrue(taskActivityManager.isScheduledForNextWeek(task));
+ taskActivityManager.setScheduledFor(task, TaskActivityUtil.getNextWeek());
+ assertTrue(taskActivityManager.isScheduledForNextWeek(task));
+ assertEquals(0, taskActivityManager.getScheduledTasks(new DateRange(start, end)).size());
+
+ // test end of two weeks
+ end = TaskActivityUtil.getNextWeek().next().getEndDate();
+ start = TaskActivityUtil.getCalendar();
+ start.setTimeInMillis(end.getTimeInMillis());
+ TaskActivityUtil.snapStartOfDay(start);
+ taskActivityManager.setScheduledFor(task, new DateRange(start, end));
+ assertEquals(1, taskActivityManager.getScheduledTasks(new DateRange(start, end)).size());
+ assertEquals(1, taskActivityManager.getScheduledTasks(TaskActivityUtil.getNextWeek().next()).size());
+
+ }
+
public void testTaskActivation() {
MockTask task = new MockTask("test:activation");
MockTaskActivationListener listener = new MockTaskActivationListener();
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ScheduleTaskMenuContributor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ScheduleTaskMenuContributor.java
index 9afb6887a..1533ed233 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ScheduleTaskMenuContributor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ScheduleTaskMenuContributor.java
@@ -127,9 +127,17 @@ public class ScheduleTaskMenuContributor implements IDynamicSubMenuContributor {
action = createDateSelectionAction(week.next().next(), null);
subMenuManager.add(action);
- // Future
if (singleTaskSelection != null && getScheduledForDate(singleTaskSelection) != null) {
- if (getScheduledForDate(singleTaskSelection).after(week.next().next().getEndDate())) {
+ // Update Two Weeks
+ DateRange range = getScheduledForDate(singleTaskSelection);
+ if (range.equals(TaskActivityUtil.getNextWeek().next())
+ || TaskActivityUtil.getNextWeek().next().includes(range)) {
+ action.setChecked(true);
+ }
+
+ // Future
+ if (getScheduledForDate(singleTaskSelection).after(week.next().next().getEndDate())
+ && !(getScheduledForDate(singleTaskSelection) instanceof WeekDateRange)) {
action = new Action() {
@Override
public void run() {

Back to the top