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.ui
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.ui')
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/Messages.java6
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListContentProvider.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListDropAdapter.java17
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskScheduleContentProvider.java124
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/messages.properties3
5 files changed, 138 insertions, 14 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/Messages.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/Messages.java
index 78a1388e5..4c073b691 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/Messages.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/Messages.java
@@ -101,8 +101,14 @@ public class Messages extends NLS {
public static String TaskListView_Task_List;
+ public static String TaskScheduleContentProvider_Completed;
+
public static String TaskScheduleContentProvider_Future;
+ public static String TaskScheduleContentProvider_Incoming;
+
+ public static String TaskScheduleContentProvider_Outgoing;
+
public static String TaskScheduleContentProvider_Two_Weeks;
public static String TaskScheduleContentProvider_Unscheduled;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListContentProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListContentProvider.java
index d382d3996..a6831a9a3 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListContentProvider.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListContentProvider.java
@@ -104,7 +104,7 @@ public class TaskListContentProvider extends AbstractTaskListContentProvider {
// return false;
}
- protected List<AbstractTaskContainer> applyFilter(Set<AbstractTaskContainer> roots) {
+ protected List<AbstractTaskContainer> applyFilter(Collection<AbstractTaskContainer> roots) {
List<AbstractTaskContainer> filteredRoots = new ArrayList<AbstractTaskContainer>();
for (AbstractTaskContainer element : roots) {
// NOTE: tasks can no longer appear as root elements
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListDropAdapter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListDropAdapter.java
index 5e0730ef6..8a352b592 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListDropAdapter.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListDropAdapter.java
@@ -34,6 +34,9 @@ import org.eclipse.mylyn.internal.tasks.core.UnsubmittedTaskContainer;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.util.AbstractRetrieveTitleFromUrlJob;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
+import org.eclipse.mylyn.internal.tasks.ui.views.TaskScheduleContentProvider.Completed;
+import org.eclipse.mylyn.internal.tasks.ui.views.TaskScheduleContentProvider.Incoming;
+import org.eclipse.mylyn.internal.tasks.ui.views.TaskScheduleContentProvider.Outgoing;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskScheduleContentProvider.Unscheduled;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.ITask;
@@ -137,13 +140,17 @@ public class TaskListDropAdapter extends ViewerDropAdapter {
if (targetCategory != null) {
moveTask(task, targetCategory);
}
+// } else if (currentTarget instanceof Incoming || currentTarget instanceof Outgoing
+// || currentTarget instanceof Completed) {
} else if (currentTarget instanceof ScheduledTaskContainer) {
ScheduledTaskContainer container = (ScheduledTaskContainer) currentTarget;
if (container instanceof Unscheduled) {
TasksUiPlugin.getTaskActivityManager().setScheduledFor((AbstractTask) task, null);
} else {
- TasksUiPlugin.getTaskActivityManager().setScheduledFor((AbstractTask) task,
- container.getDateRange());
+ if (!task.isCompleted()) {
+ TasksUiPlugin.getTaskActivityManager().setScheduledFor((AbstractTask) task,
+ container.getDateRange());
+ }
}
} else if (currentTarget == null) {
moveTask(task, TasksUiPlugin.getTaskList().getDefaultCategory());
@@ -242,7 +249,11 @@ public class TaskListDropAdapter extends ViewerDropAdapter {
return false;
} else if (LocalSelectionTransfer.getTransfer().isSupportedType(transferType)) {
localTransfer = true;
- if (getCurrentTarget() instanceof UncategorizedTaskContainer || getCurrentTarget() instanceof TaskCategory
+ if (getCurrentTarget() instanceof Incoming || getCurrentTarget() instanceof Outgoing
+ || getCurrentTarget() instanceof Completed) {
+ return false;
+ } else if (getCurrentTarget() instanceof UncategorizedTaskContainer
+ || getCurrentTarget() instanceof TaskCategory
|| getCurrentTarget() instanceof UnmatchedTaskContainer
|| getCurrentTarget() instanceof ScheduledTaskContainer) {
return true;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskScheduleContentProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskScheduleContentProvider.java
index a85f387ce..c2c2eb60e 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskScheduleContentProvider.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskScheduleContentProvider.java
@@ -11,10 +11,12 @@
package org.eclipse.mylyn.internal.tasks.ui.views;
+import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -22,8 +24,10 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
import org.eclipse.mylyn.internal.tasks.core.DateRange;
+import org.eclipse.mylyn.internal.tasks.core.ITaskFilter;
import org.eclipse.mylyn.internal.tasks.core.ScheduledTaskContainer;
import org.eclipse.mylyn.internal.tasks.core.TaskActivityManager;
import org.eclipse.mylyn.internal.tasks.core.TaskActivityUtil;
@@ -32,6 +36,7 @@ import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.ITaskActivityListener;
import org.eclipse.mylyn.tasks.core.ITaskContainer;
+import org.eclipse.mylyn.tasks.core.ITask.SynchronizationState;
import org.eclipse.ui.PlatformUI;
/**
@@ -47,8 +52,22 @@ public class TaskScheduleContentProvider extends TaskListContentProvider impleme
private final Calendar END_OF_TIME;
+ private final Calendar INCOMING_TIME;
+
+ private final Calendar OUTGOING_TIME;
+
+ private final Calendar COMPLETED_TIME;
+
+ private final List<AbstractTaskContainer> containers = new ArrayList<AbstractTaskContainer>();
+
private Job rolloverJob;
+ private final Incoming incoming;
+
+ private final Outgoing outgoing;
+
+ private final Completed completed;
+
public TaskScheduleContentProvider(TaskListView taskListView) {
super(taskListView);
this.taskActivityManager = TasksUiPlugin.getTaskActivityManager();
@@ -57,14 +76,29 @@ public class TaskScheduleContentProvider extends TaskListContentProvider impleme
END_OF_TIME.add(Calendar.YEAR, 5000);
END_OF_TIME.getTime();
unscheduled = new Unscheduled(taskActivityManager, new DateRange(END_OF_TIME));
+
+ INCOMING_TIME = TaskActivityUtil.getCalendar();
+ INCOMING_TIME.setTimeInMillis(END_OF_TIME.getTimeInMillis() - 1);
+ incoming = new Incoming();
+
+ OUTGOING_TIME = TaskActivityUtil.getCalendar();
+ OUTGOING_TIME.setTimeInMillis(END_OF_TIME.getTimeInMillis() - 2);
+ outgoing = new Outgoing();
+
+ COMPLETED_TIME = TaskActivityUtil.getCalendar();
+ COMPLETED_TIME.setTimeInMillis(END_OF_TIME.getTimeInMillis() + 2);
+ completed = new Completed();
+
}
@Override
public Object[] getElements(Object parent) {
+ containers.clear();
+
if (parent != null && parent.equals(this.taskListView.getViewSite())) {
- Set<AbstractTaskContainer> containers = new HashSet<AbstractTaskContainer>();
+ //Set<AbstractTaskContainer> containers = new HashSet<AbstractTaskContainer>();
WeekDateRange week = TaskActivityUtil.getCurrentWeek();
WeekDateRange nextWeek = TaskActivityUtil.getNextWeek();
@@ -85,6 +119,8 @@ public class TaskScheduleContentProvider extends TaskListContentProvider impleme
for (DateRange day : week.getRemainingDays()) {
containers.add(new ScheduledTaskContainer(TasksUiPlugin.getTaskActivityManager(), day));
}
+
+ // This Week
containers.add(new ScheduledTaskContainer(TasksUiPlugin.getTaskActivityManager(), week));
for (DateRange day : nextWeek.getDaysOfWeek()) {
@@ -98,7 +134,6 @@ public class TaskScheduleContentProvider extends TaskListContentProvider impleme
.next(), Messages.TaskScheduleContentProvider_Two_Weeks);
containers.add(twoWeeksContainer);
- containers.add(unscheduled);
Calendar startDate = TaskActivityUtil.getCalendar();
startDate.setTimeInMillis(twoWeeksContainer.getEnd().getTimeInMillis());
TaskActivityUtil.snapNextDay(startDate);
@@ -110,6 +145,35 @@ public class TaskScheduleContentProvider extends TaskListContentProvider impleme
Messages.TaskScheduleContentProvider_Future);
containers.add(futureContainer);
+ // Outgoing
+ containers.add(outgoing);
+
+ // Incoming
+ containers.add(incoming);
+
+ // Unscheduled
+ containers.add(unscheduled);
+
+ // Completed
+ containers.add(completed);
+
+ Collection<AbstractTask> tasks = TasksUiPlugin.getTaskList().getAllTasks();
+ Set<AbstractTask> allocated = new HashSet<AbstractTask>();
+
+ for (AbstractTaskContainer container : containers) {
+ container.clear();
+ for (AbstractTask abstractTask : tasks) {
+ if (!allocated.contains(abstractTask)) {
+ if (container instanceof ITaskFilter) {
+ if (((ITaskFilter) container).select(abstractTask)) {
+ allocated.add(abstractTask);
+ container.internalAddChild(abstractTask);
+ }
+ }
+ }
+ }
+ }
+
return applyFilter(containers).toArray();
} else {
@@ -186,21 +250,62 @@ public class TaskScheduleContentProvider extends TaskListContentProvider impleme
private final TaskActivityManager activityManager;
+ boolean cached = false;
+
public Unscheduled(TaskActivityManager activityManager, DateRange range) {
super(activityManager, range, Messages.TaskScheduleContentProvider_Unscheduled);
this.activityManager = activityManager;
}
@Override
- public Collection<ITask> getChildren() {
- Set<ITask> all = new HashSet<ITask>();
- for (ITask task : activityManager.getUnscheduled()) {
- if (!task.isCompleted() || (task.isCompleted() && !task.getSynchronizationState().isSynchronized())) {
- all.add(task);
- }
+ public boolean select(ITask task) {
+ if (activityManager.getUnscheduled().contains(task)) {
+ return !task.isCompleted();
}
- return all;
+ return false;
}
+
+ }
+
+ public class Incoming extends ScheduledTaskContainer {
+
+ public Incoming() {
+ super(taskActivityManager, new DateRange(INCOMING_TIME), Messages.TaskScheduleContentProvider_Incoming);
+ }
+
+ @Override
+ public boolean select(ITask task) {
+ return (task.getSynchronizationState() == SynchronizationState.INCOMING || task.getSynchronizationState() == SynchronizationState.INCOMING_NEW);
+
+ }
+
+ }
+
+ public class Outgoing extends ScheduledTaskContainer {
+
+ public Outgoing() {
+ super(taskActivityManager, new DateRange(OUTGOING_TIME), Messages.TaskScheduleContentProvider_Outgoing);
+ }
+
+ @Override
+ public boolean select(ITask task) {
+ return (task.getSynchronizationState() == SynchronizationState.OUTGOING || task.getSynchronizationState() == SynchronizationState.OUTGOING_NEW);
+
+ }
+
+ }
+
+ public class Completed extends ScheduledTaskContainer {
+
+ public Completed() {
+ super(taskActivityManager, new DateRange(COMPLETED_TIME), Messages.TaskScheduleContentProvider_Completed);
+ }
+
+ @Override
+ public boolean select(ITask task) {
+ return true;
+ }
+
}
private class RolloverCheck extends Job {
@@ -215,5 +320,4 @@ public class TaskScheduleContentProvider extends TaskListContentProvider impleme
return Status.OK_STATUS;
}
}
-
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/messages.properties b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/messages.properties
index 2bd1f50b5..0982382c7 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/messages.properties
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/messages.properties
@@ -53,7 +53,10 @@ TaskListView_Repository=Repository
TaskListView_Summary=Summary
TaskListView_Task_List=Task List
+TaskScheduleContentProvider_Completed=Completed
TaskScheduleContentProvider_Future=Future
+TaskScheduleContentProvider_Incoming=Incoming
+TaskScheduleContentProvider_Outgoing=Outgoing
TaskScheduleContentProvider_Two_Weeks=Two Weeks
TaskScheduleContentProvider_Unscheduled=Unscheduled

Back to the top