Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2010-05-26 01:22:15 -0400
committerspingel2010-05-26 01:22:15 -0400
commite884f0e1d240f1ae8bcb3a0a3df8b86fa154e381 (patch)
treee402038be2163d3ea5b741545bb7dc91cceb87b2 /org.eclipse.mylyn.tasks.ui
parent8ba0fe2ef1305ec12cebea5891f05be193792681 (diff)
downloadorg.eclipse.mylyn.tasks-e884f0e1d240f1ae8bcb3a0a3df8b86fa154e381.tar.gz
org.eclipse.mylyn.tasks-e884f0e1d240f1ae8bcb3a0a3df8b86fa154e381.tar.xz
org.eclipse.mylyn.tasks-e884f0e1d240f1ae8bcb3a0a3df8b86fa154e381.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, 14 insertions, 138 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 4c073b691..78a1388e5 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,14 +101,8 @@ 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 a6831a9a3..d382d3996 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(Collection<AbstractTaskContainer> roots) {
+ protected List<AbstractTaskContainer> applyFilter(Set<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 8a352b592..5e0730ef6 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,9 +34,6 @@ 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;
@@ -140,17 +137,13 @@ 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 {
- if (!task.isCompleted()) {
- TasksUiPlugin.getTaskActivityManager().setScheduledFor((AbstractTask) task,
- container.getDateRange());
- }
+ TasksUiPlugin.getTaskActivityManager().setScheduledFor((AbstractTask) task,
+ container.getDateRange());
}
} else if (currentTarget == null) {
moveTask(task, TasksUiPlugin.getTaskList().getDefaultCategory());
@@ -249,11 +242,7 @@ public class TaskListDropAdapter extends ViewerDropAdapter {
return false;
} else if (LocalSelectionTransfer.getTransfer().isSupportedType(transferType)) {
localTransfer = true;
- if (getCurrentTarget() instanceof Incoming || getCurrentTarget() instanceof Outgoing
- || getCurrentTarget() instanceof Completed) {
- return false;
- } else if (getCurrentTarget() instanceof UncategorizedTaskContainer
- || getCurrentTarget() instanceof TaskCategory
+ 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 c2c2eb60e..a85f387ce 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,12 +11,10 @@
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;
@@ -24,10 +22,8 @@ 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;
@@ -36,7 +32,6 @@ 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;
/**
@@ -52,22 +47,8 @@ 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();
@@ -76,29 +57,14 @@ 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();
@@ -119,8 +85,6 @@ 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()) {
@@ -134,6 +98,7 @@ 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);
@@ -145,35 +110,6 @@ 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 {
@@ -250,62 +186,21 @@ 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 boolean select(ITask task) {
- if (activityManager.getUnscheduled().contains(task)) {
- return !task.isCompleted();
+ 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);
+ }
}
- return false;
+ return all;
}
-
- }
-
- 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 {
@@ -320,4 +215,5 @@ 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 0982382c7..2bd1f50b5 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,10 +53,7 @@ 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