Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2008-10-03 14:24:57 -0400
committerspingel2008-10-03 14:24:57 -0400
commit413341b0de8a28e754a1fe664188cbd677a5d935 (patch)
tree2f555de08b1b5c6ebd7d7af84f015629459edf4a
parentfbc54aaaa9a1547a251e15ea3644a69baa6cf523 (diff)
downloadorg.eclipse.mylyn.tasks-413341b0de8a28e754a1fe664188cbd677a5d935.tar.gz
org.eclipse.mylyn.tasks-413341b0de8a28e754a1fe664188cbd677a5d935.tar.xz
org.eclipse.mylyn.tasks-413341b0de8a28e754a1fe664188cbd677a5d935.zip
190503: Scheduled mode in task list should allow "Next Week" category to be viewed by day
https://bugs.eclipse.org/bugs/show_bug.cgi?id=190503
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/DateRange.java12
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ScheduledTaskContainer.java6
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskActivityManager.java4
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/ScheduledPresentationTest.java7
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListDropAdapter.java9
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListInterestFilter.java36
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskScheduleContentProvider.java9
7 files changed, 55 insertions, 28 deletions
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/DateRange.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/DateRange.java
index af4e0d87e..7d3ca39e8 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/DateRange.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/DateRange.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2004, 2008 Tasktop Technologies and others.
+ * Copyright (c) 2004, 2008 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
@@ -26,9 +26,9 @@ public class DateRange implements Comparable<DateRange> {
private static final String DESCRIPTION_PREVIOUS_WEEK = "Previous Week";
- private static final String DESCRIPTION_THIS_WEEK = "This Week";
+ private static final String DESCRIPTION_THIS_WEEK = "Someday This Week";
- private static final String DESCRIPTION_NEXT_WEEK = "Next Week";
+ private static final String DESCRIPTION_NEXT_WEEK = "Someday Next Week";
private static final String DESCRIPTION_WEEK_AFTER_NEXT = "Two Weeks";
@@ -74,11 +74,15 @@ public class DateRange implements Comparable<DateRange> {
*/
@Override
public String toString() {
+ return toString(true);
+ }
+
+ public String toString(boolean useDayOfWeekForNextWeek) {
boolean isThisWeek = TaskActivityUtil.getCurrentWeek().includes(this);
Calendar endNextWeek = TaskActivityUtil.getCalendar();
endNextWeek.add(Calendar.DAY_OF_YEAR, 7);
boolean isNextWeek = TaskActivityUtil.getNextWeek().includes(this) && this.before(endNextWeek);
- if (isDay() && (isThisWeek || isNextWeek)) {
+ if (isDay() && (isThisWeek || (useDayOfWeekForNextWeek && isNextWeek))) {
String day = "";
switch (getStartDate().get(Calendar.DAY_OF_WEEK)) {
case Calendar.MONDAY:
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 dcf494f82..b80e4d5af 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
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2004, 2008 Tasktop Technologies and others.
+ * Copyright (c) 2004, 2008 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
@@ -32,11 +32,11 @@ public class ScheduledTaskContainer extends AbstractTaskContainer {
private final DateRange range;
public ScheduledTaskContainer(TaskActivityManager activityManager, DateRange range, String summary) {
- super(summary == null ? range.toString() : summary);
+ super(summary == null ? range.toString(false) : summary);
this.activityManager = activityManager;
this.range = range;
if (summary == null) {
- this.summary = range.toString();
+ this.summary = range.toString(false);
} else {
this.summary = summary;
}
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 399502381..dc63957b8 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
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2004, 2008 Tasktop Technologies and others.
+ * Copyright (c) 2004, 2008 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
@@ -328,7 +328,7 @@ public class TaskActivityManager implements ITaskActivityManager {
Set<ITask> result = scheduledTasks.get(range);
if (result != null && !result.isEmpty()) {
resultingTasks.addAll(result);
- } else {
+ } else if (!range.isWeek()) {
return getScheduledTasks(range.getStartDate(), range.getEndDate());
}
}
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/ScheduledPresentationTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/ScheduledPresentationTest.java
index 98f06e000..90ee70549 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/ScheduledPresentationTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/ScheduledPresentationTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2004, 2008 Tasktop Technologies and others.
+ * Copyright (c) 2004, 2008 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
@@ -46,15 +46,16 @@ public class ScheduledPresentationTest extends TestCase {
}
public void testWeekStartChange() {
+ TaskListInterestFilter filter = new TaskListInterestFilter();
TasksUiPlugin.getTaskActivityManager().setWeekStartDay(Calendar.MONDAY);
DateRange lastDay = TaskActivityUtil.getCurrentWeek().getDayOfWeek(Calendar.SUNDAY);
AbstractTask task1 = new LocalTask("task 1", "Task 1");
TasksUiPlugin.getTaskList().addTask(task1);
TasksUiPlugin.getTaskActivityManager().setScheduledFor(task1, lastDay);
- assertTrue(TaskListInterestFilter.isInterestingForThisWeek(null, task1));
+ assertTrue(filter.isInterestingForThisWeek(null, task1));
TasksUiPlugin.getTaskActivityManager().setWeekStartDay(Calendar.SUNDAY);
- assertFalse(TaskListInterestFilter.isInterestingForThisWeek(null, task1));
+ assertFalse(filter.isInterestingForThisWeek(null, task1));
}
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 6146e1326..e17543b9e 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
@@ -41,6 +41,7 @@ import org.eclipse.mylyn.internal.tasks.ui.TaskTransfer;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.actions.QueryImportAction;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
+import org.eclipse.mylyn.internal.tasks.ui.views.TaskScheduleContentProvider.Unscheduled;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.ITaskContainer;
@@ -209,8 +210,12 @@ public class TaskListDropAdapter extends ViewerDropAdapter {
}
} else if (currentTarget instanceof ScheduledTaskContainer) {
ScheduledTaskContainer container = (ScheduledTaskContainer) currentTarget;
- TasksUiPlugin.getTaskActivityManager().setScheduledFor((AbstractTask) task,
- container.getDateRange());
+ if (container instanceof Unscheduled) {
+ TasksUiPlugin.getTaskActivityManager().setScheduledFor((AbstractTask) task, null);
+ } else {
+ TasksUiPlugin.getTaskActivityManager().setScheduledFor((AbstractTask) task,
+ container.getDateRange());
+ }
} else if (currentTarget == null) {
TasksUiInternal.getTaskList().addTask(newTask, TasksUiPlugin.getTaskList().getDefaultCategory());
}
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 efac2757c..37a19ede6 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
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2004, 2008 Tasktop Technologies and others.
+ * Copyright (c) 2004, 2008 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
@@ -23,6 +23,7 @@ import org.eclipse.mylyn.internal.tasks.core.ScheduledTaskContainer;
import org.eclipse.mylyn.internal.tasks.core.TaskActivityUtil;
import org.eclipse.mylyn.internal.tasks.ui.AbstractTaskListFilter;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
+import org.eclipse.mylyn.internal.tasks.ui.views.TaskScheduleContentProvider.Unscheduled;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.ITaskContainer;
@@ -120,26 +121,37 @@ public class TaskListInterestFilter extends AbstractTaskListFilter {
return false;
}
- private static boolean shouldShowInFocusedWorkweekDateContainer(Object parent, ITask task) {
+ private boolean shouldShowInFocusedWorkweekDateContainer(Object parent, ITask task) {
if (parent instanceof ScheduledTaskContainer) {
+
ScheduledTaskContainer container = (ScheduledTaskContainer) parent;
- if (container.isWeekDay() || container.isPresent()) {
- return true;
+
+ if (container instanceof Unscheduled) {
+ return false;
}
-// if (!TasksUiPlugin.getTaskActivityManager().isWeekDay((ScheduledTaskContainer) parent)) {
-// return false;
-// }
- if (TasksUiPlugin.getTaskActivityManager().isOverdue(task)
- || TasksUiPlugin.getTaskActivityManager().isPastReminder((AbstractTask) task)) {
+
+ if (isDateRangeInteresting(container)) {
return true;
}
+// if (container.isWeekDay() || container.isPresent()) {
+// return true;
+// }
+//
+//// if (!TasksUiPlugin.getTaskActivityManager().isWeekDay((ScheduledTaskContainer) parent)) {
+//// return false;
+//// }
+// if (TasksUiPlugin.getTaskActivityManager().isOverdue(task)
+// || TasksUiPlugin.getTaskActivityManager().isPastReminder((AbstractTask) task)) {
+// return true;
+// }
+
}
return false;
}
- public static boolean isInterestingForThisWeek(Object parent, AbstractTask task) {
+ public boolean isInterestingForThisWeek(Object parent, AbstractTask task) {
if (parent instanceof ScheduledTaskContainer) {
return shouldShowInFocusedWorkweekDateContainer(parent, task);
} else {
@@ -151,7 +163,7 @@ public class TaskListInterestFilter extends AbstractTaskListFilter {
}
}
- public static boolean hasChanges(Object parent, ITask task) {
+ public boolean hasChanges(Object parent, ITask task) {
if (parent instanceof ScheduledTaskContainer && !(parent instanceof TaskScheduleContentProvider.Unscheduled)) {
if (!shouldShowInFocusedWorkweekDateContainer(parent, task)) {
return false;
@@ -160,7 +172,7 @@ public class TaskListInterestFilter extends AbstractTaskListFilter {
return hasChangesHelper(parent, task);
}
- private static boolean hasChangesHelper(Object parent, ITask task) {
+ private boolean hasChangesHelper(Object parent, ITask task) {
if (task.getSynchronizationState().isOutgoing()) {
return true;
} else if (task.getSynchronizationState().isIncoming()) {
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 f2c33d9c6..41fd163e0 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
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2004, 2008 Tasktop Technologies and others.
+ * Copyright (c) 2004, 2008 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
@@ -65,6 +65,7 @@ public class TaskScheduleContentProvider extends TaskListContentProvider impleme
Set<AbstractTaskContainer> containers = new HashSet<AbstractTaskContainer>();
WeekDateRange week = TaskActivityUtil.getCurrentWeek();
+ WeekDateRange nextWeek = TaskActivityUtil.getNextWeek();
timer.cancel();
timer = new Timer();
@@ -75,7 +76,11 @@ public class TaskScheduleContentProvider extends TaskListContentProvider impleme
}
containers.add(new ScheduledTaskContainer(TasksUiPlugin.getTaskActivityManager(), week));
- ScheduledTaskContainer nextWeekContainer = new ScheduledTaskContainer(taskActivityManager, week.next());
+ for (DateRange day : nextWeek.getDaysOfWeek()) {
+ containers.add(new ScheduledTaskContainer(TasksUiPlugin.getTaskActivityManager(), day));
+ }
+
+ ScheduledTaskContainer nextWeekContainer = new ScheduledTaskContainer(taskActivityManager, nextWeek);
containers.add(nextWeekContainer);
ScheduledTaskContainer twoWeeksContainer = new ScheduledTaskContainer(taskActivityManager, week.next()

Back to the top