Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrelves2008-09-03 18:46:47 -0400
committerrelves2008-09-03 18:46:47 -0400
commit5f7eb93b46473b83785e42f164947286ba2d9103 (patch)
treea8a94a61701f3f0f875b9d8212fbac65d1785e8e
parentec39d0a804e9187c0d90fdf2ba88f021a9f7825b (diff)
downloadorg.eclipse.mylyn.tasks-5f7eb93b46473b83785e42f164947286ba2d9103.tar.gz
org.eclipse.mylyn.tasks-5f7eb93b46473b83785e42f164947286ba2d9103.tar.xz
org.eclipse.mylyn.tasks-5f7eb93b46473b83785e42f164947286ba2d9103.zip
NEW - bug 244092: eliminate use of AbstractTask.isPastReminder
https://bugs.eclipse.org/bugs/show_bug.cgi?id=244092
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/AbstractTask.java2
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskActivityManager.java20
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListInterestFilter.java7
4 files changed, 24 insertions, 7 deletions
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/AbstractTask.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/AbstractTask.java
index 50a9461dd..c26f09129 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/AbstractTask.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/AbstractTask.java
@@ -404,7 +404,7 @@ public abstract class AbstractTask extends AbstractTaskContainer implements ITas
*/
@Deprecated
public boolean isPastReminder() {
- if (isCompleted() || scheduledForDate == null) {
+ if (isCompleted() || scheduledForDate == null || !getScheduledForDate().isDay()) {
return false;
} else {
if (/*!internalIsFloatingScheduledDate() && */scheduledForDate.getEndDate().compareTo(
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 0713510ea..8e0912e0f 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
@@ -613,8 +613,7 @@ public class TaskActivityManager implements ITaskActivityManager {
}
public boolean isPastReminder(AbstractTask task) {
- if (task == null || task.isCompleted() || task.getScheduledForDate() == null
- || !task.getScheduledForDate().isDay()) {
+ if (task == null || task.isCompleted() || task.getScheduledForDate() == null) {
return false;
} else {
return isPastReminder(task.getScheduledForDate(), task.isCompleted());
@@ -625,7 +624,7 @@ public class TaskActivityManager implements ITaskActivityManager {
if (date == null || isComplete) {
return false;
} else {
- if (date.getEndDate().compareTo(TaskActivityUtil.getCalendar()) < 0) {
+ if (date.getEndDate().compareTo(TaskActivityUtil.getCalendar()) < 0 && date.isDay()) {
return true;
} else {
return false;
@@ -721,6 +720,21 @@ public class TaskActivityManager implements ITaskActivityManager {
return false;
}
+ public boolean isSheduledForPastWeek(AbstractTask task) {
+ boolean result = false;
+ if (task != null && task.getScheduledForDate() != null) {
+ result = isSheduledForPastWeek(task.getScheduledForDate());
+ }
+ return result;
+ }
+
+ private boolean isSheduledForPastWeek(DateRange range) {
+ if (range != null) {
+ return range.isWeek() && range.isPast();
+ }
+ return false;
+ }
+
public boolean isScheduledForNextWeek(AbstractTask task) {
if (task != null) {
DateRange range = task.getScheduledForDate();
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java
index 3ead55452..b11561f3b 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java
@@ -273,7 +273,7 @@ public class TasksUiPlugin extends AbstractUIPlugin {
Collection<AbstractTask> allTasks = TasksUiPlugin.getTaskList().getAllTasks();
Set<AbstractNotification> reminders = new HashSet<AbstractNotification>();
for (AbstractTask task : allTasks) {
- if (task.isPastReminder() && !task.isReminded()) {
+ if (TasksUiPlugin.getTaskActivityManager().isPastReminder(task) && !task.isReminded()) {
reminders.add(new TaskListNotificationReminder(task));
task.setReminded(true);
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListInterestFilter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListInterestFilter.java
index 18beb2618..9c0000eba 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListInterestFilter.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListInterestFilter.java
@@ -126,7 +126,8 @@ public class TaskListInterestFilter extends AbstractTaskListFilter {
// if (!TasksUiPlugin.getTaskActivityManager().isWeekDay((ScheduledTaskContainer) parent)) {
// return false;
// }
- if (TasksUiPlugin.getTaskActivityManager().isOverdue(task) || ((AbstractTask) task).isPastReminder()) {
+ if (TasksUiPlugin.getTaskActivityManager().isOverdue(task)
+ || TasksUiPlugin.getTaskActivityManager().isPastReminder((AbstractTask) task)) {
return true;
}
@@ -139,7 +140,9 @@ public class TaskListInterestFilter extends AbstractTaskListFilter {
if (parent instanceof ScheduledTaskContainer) {
return shouldShowInFocusedWorkweekDateContainer(parent, task);
} else {
- return task.isPastReminder() || TasksUiPlugin.getTaskActivityManager().isScheduledForThisWeek(task)
+ return TasksUiPlugin.getTaskActivityManager().isPastReminder(task)
+ || TasksUiPlugin.getTaskActivityManager().isSheduledForPastWeek(task)
+ || TasksUiPlugin.getTaskActivityManager().isScheduledForThisWeek(task)
|| TasksUiPlugin.getTaskActivityManager().isDueThisWeek(task)
|| TasksUiPlugin.getTaskActivityManager().isScheduledForToday(task);
}

Back to the top