Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrelves2010-05-26 00:04:53 -0400
committerrelves2010-05-26 00:04:53 -0400
commit8ba0fe2ef1305ec12cebea5891f05be193792681 (patch)
treeb99c931bcf347788f28c35af78f126ef8e0dce48 /org.eclipse.mylyn.tasks.core
parent2c56cb95293d0eae3f83cfdaaa44d89b5a5ada4f (diff)
downloadorg.eclipse.mylyn.tasks-8ba0fe2ef1305ec12cebea5891f05be193792681.tar.gz
org.eclipse.mylyn.tasks-8ba0fe2ef1305ec12cebea5891f05be193792681.tar.xz
org.eclipse.mylyn.tasks-8ba0fe2ef1305ec12cebea5891f05be193792681.zip
NEW - bug 314166: fix the scheduled presentation bins and sort order
https://bugs.eclipse.org/bugs/show_bug.cgi?id=314166
Diffstat (limited to 'org.eclipse.mylyn.tasks.core')
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/AbstractTaskContainer.java18
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ITaskFilter.java23
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ScheduledTaskContainer.java75
3 files changed, 39 insertions, 77 deletions
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/AbstractTaskContainer.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/AbstractTaskContainer.java
index 781a8bfef..fe836edf9 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/AbstractTaskContainer.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/AbstractTaskContainer.java
@@ -64,9 +64,8 @@ public abstract class AbstractTaskContainer extends PlatformObject implements IR
}
/**
- * Removes any cyclic dependencies in children.
- *
- * TODO: review to make sure that this is too expensive, or move to creation.
+ * Removes any cyclic dependencies in children. TODO: review to make sure that this is too expensive, or move to
+ * creation.
*
* @since 3.0
*/
@@ -75,9 +74,7 @@ public abstract class AbstractTaskContainer extends PlatformObject implements IR
}
/**
- * Maxes out at a depth of 10.
- *
- * TODO: review policy
+ * Maxes out at a depth of 10. TODO: review policy
*/
public boolean contains(String handle) {
Assert.isNotNull(handle);
@@ -180,4 +177,13 @@ public abstract class AbstractTaskContainer extends PlatformObject implements IR
return true;
}
+ /**
+ * removes all children from the container
+ *
+ * @since 3.4
+ */
+ public void clear() {
+ children.clear();
+ }
+
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ITaskFilter.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ITaskFilter.java
new file mode 100644
index 000000000..e7b8fa449
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ITaskFilter.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.tasks.core;
+
+import org.eclipse.mylyn.tasks.core.ITask;
+
+/**
+ * @author Robert Elves
+ */
+public interface ITaskFilter {
+
+ public boolean select(ITask task);
+
+}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ScheduledTaskContainer.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ScheduledTaskContainer.java
index c92cf0a33..32bc442e0 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ScheduledTaskContainer.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ScheduledTaskContainer.java
@@ -12,7 +12,6 @@
package org.eclipse.mylyn.internal.tasks.core;
import java.util.Calendar;
-import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
@@ -23,7 +22,7 @@ import org.eclipse.mylyn.tasks.core.ITask;
* @author Rob Elves
* @author Mik Kersten
*/
-public class ScheduledTaskContainer extends AbstractTaskContainer {
+public class ScheduledTaskContainer extends AbstractTaskContainer implements ITaskFilter {
private final TaskActivityManager activityManager;
@@ -54,74 +53,7 @@ public class ScheduledTaskContainer extends AbstractTaskContainer {
return range.getStartDate().before(Calendar.getInstance()) && range.getEndDate().after(Calendar.getInstance());
}
-// public boolean isWeekDay() {
-// return TaskActivityUtil.getCurrentWeek().isCurrentWeekDay(range);
-// }
-
-// public boolean isToday() {
-// if (range instanceof DayDateRange) {
-// return ((DayDateRange) range).isToday();
-// }
-// return false;
-// }
-
-// public Collection<ITask> getChildren() {
-// Set<ITask> children = new HashSet<ITask>();
-// Calendar beginning = TaskActivityUtil.getCalendar();
-// beginning.setTimeInMillis(0);
-// if (isFloating() && !isFuture()) {
-// for (ITask task : activityManager.getScheduledTasks(rangebeginning, getEndDate())) {
-// if (task.internalIsFloatingScheduledDate()) {
-// children.add(task);
-// }
-// }
-// } else if (isPresent()) {
-// // add all due/overdue
-// Calendar end = TaskActivityUtil.getCalendar();
-// end.set(5000, 12, 1);
-// for (ITask task : activityManager.getDueTasks(beginning, getEndDate())) {
-// if (activityManager.isOwnedByUser(task)) {
-// children.add(task);
-// }
-// }
-//
-// // add all scheduled/overscheduled
-// for (ITask task : activityManager.getScheduledTasks(beginning, getEndDate())) {
-// if (!task.internalIsFloatingScheduledDate() && !task.isCompleted()) {
-// children.add(task);
-// }
-// }
-//
-// // if not scheduled or due in future, and is active, place in today bin
-// ITask activeTask = activityManager.getActiveTask();
-// if (activeTask != null && !children.contains(activeTask)) {
-// Set<ITask> futureScheduled = activityManager.getScheduledTasks(getStartDate(), end);
-// for (ITask task : activityManager.getDueTasks(getStartDate(), end)) {
-// if (activityManager.isOwnedByUser(task)) {
-// futureScheduled.add(task);
-// }
-// }
-// if (!futureScheduled.contains(activeTask)) {
-// children.add(activeTask);
-// }
-// }
-// } else if (isFuture()) {
-// children.addAll(activityManager.getScheduledTasks(getStartDate(), getEndDate()));
-// for (ITask task : activityManager.getDueTasks(getStartDate(), getEndDate())) {
-// if (activityManager.isOwnedByUser(task)) {
-// children.add(task);
-// }
-// }
-// } else {
-// children.addAll(activityManager.getActiveTasks(range.getStartDate(), range.getEndDate()));
-// }
-// return children;
-// }
-
- @Override
- public Collection<ITask> getChildren() {
-
- // TODO: Cache this information until the next modification to pertinent data
+ public boolean select(ITask selectTask) {
Set<ITask> children = new HashSet<ITask>();
@@ -167,7 +99,8 @@ public class ScheduledTaskContainer extends AbstractTaskContainer {
}
}
- return children;
+ return children.contains(selectTask);
+
}
@Override

Back to the top