Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrelves2008-09-03 13:30:02 -0400
committerrelves2008-09-03 13:30:02 -0400
commit2e288ec95ceff6101c9a33eb549f2d9fc643bbef (patch)
treead2cb9ae268899ab90f37954b32f24d06a1065a3
parent7be67c4d56d09b207239b71a1f45acc19fc1b0ac (diff)
downloadorg.eclipse.mylyn.tasks-2e288ec95ceff6101c9a33eb549f2d9fc643bbef.tar.gz
org.eclipse.mylyn.tasks-2e288ec95ceff6101c9a33eb549f2d9fc643bbef.tar.xz
org.eclipse.mylyn.tasks-2e288ec95ceff6101c9a33eb549f2d9fc643bbef.zip
NEW - bug 238704: Saturday week start
https://bugs.eclipse.org/bugs/show_bug.cgi?id=238704
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskActivityUtil.java23
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ScheduleTaskMenuContributor.java6
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/preferences/TasksUiPreferencePage.java18
3 files changed, 36 insertions, 11 deletions
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskActivityUtil.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskActivityUtil.java
index f3208cd02..a73079ae0 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskActivityUtil.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskActivityUtil.java
@@ -72,21 +72,24 @@ public class TaskActivityUtil {
}
public static Calendar snapEndOfWeek(Calendar cal) {
- if (cal.getFirstDayOfWeek() == Calendar.MONDAY) {
- cal.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
- } else {
- cal.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY);
- }
+
+ cal.set(Calendar.DAY_OF_WEEK, getLastCalDayInt(cal));
+
snapEndOfDay(cal);
return cal;
}
- public static Calendar snapEndOfNextWeek(Calendar cal) {
- if (cal.getFirstDayOfWeek() == Calendar.MONDAY) {
- cal.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
- } else {
- cal.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY);
+ private static int getLastCalDayInt(Calendar cal) {
+ int last = cal.getFirstDayOfWeek() - 1;
+
+ if (last == 0) {
+ last = Calendar.SATURDAY;
}
+
+ return last;
+ }
+
+ public static Calendar snapEndOfNextWeek(Calendar cal) {
snapEndOfWeek(cal);
cal.add(Calendar.WEEK_OF_MONTH, 1);
return cal;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ScheduleTaskMenuContributor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ScheduleTaskMenuContributor.java
index 3d2054560..30b0cda76 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ScheduleTaskMenuContributor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ScheduleTaskMenuContributor.java
@@ -102,7 +102,11 @@ public class ScheduleTaskMenuContributor implements IDynamicSubMenuContributor {
int toAdd = 7 - days;
WeekDateRange nextWeek = TaskActivityUtil.getNextWeek();
for (int x = 0; x < toAdd; x++) {
- DateRange day = nextWeek.getDayOfWeek(TasksUiPlugin.getTaskActivityManager().getWeekStartDay() + x);
+ int next = TasksUiPlugin.getTaskActivityManager().getWeekStartDay() + x;
+ if (next > Calendar.SATURDAY) {
+ next = x;
+ }
+ DateRange day = nextWeek.getDayOfWeek(next);
Action action = createDateSelectionAction(day, null);
subMenuManager.add(action);
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/preferences/TasksUiPreferencePage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/preferences/TasksUiPreferencePage.java
index 105ba946b..45cffc3ac 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/preferences/TasksUiPreferencePage.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/preferences/TasksUiPreferencePage.java
@@ -61,10 +61,20 @@ import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
*/
public class TasksUiPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
+ private static final String LABEL_FRIDAY = "Friday";
+
+ private static final String LABEL_THURSDAY = "Thursday";
+
+ private static final String LABEL_WEDNESDAY = "Wednesday";
+
+ private static final String LABEL_TUESDAY = "Tuesday";
+
private static final String LABEL_MONDAY = "Monday";
private static final String LABEL_SUNDAY = "Sunday";
+ private static final String LABEL_SATURDAY = "Saturday";
+
public static final String ID = "org.eclipse.mylyn.tasks.ui.preferences";
private static final String FOLDER_SELECTION_MESSAGE = "Specify the folder for tasks";
@@ -484,8 +494,16 @@ public class TasksUiPreferencePage extends PreferencePage implements IWorkbenchP
weekStartLabel.setText("Week Start:");
weekStartCombo = new Combo(group, SWT.READ_ONLY);
// Note: Calendar.SUNDAY = 1
+// weekStartCombo.add(LABEL_SUNDAY);
+// weekStartCombo.add(LABEL_MONDAY);
+// weekStartCombo.add(LABEL_SATURDAY);
weekStartCombo.add(LABEL_SUNDAY);
weekStartCombo.add(LABEL_MONDAY);
+ weekStartCombo.add(LABEL_TUESDAY);
+ weekStartCombo.add(LABEL_WEDNESDAY);
+ weekStartCombo.add(LABEL_THURSDAY);
+ weekStartCombo.add(LABEL_FRIDAY);
+ weekStartCombo.add(LABEL_SATURDAY);
weekStartCombo.select(getPreferenceStore().getInt(ITasksUiPreferenceConstants.WEEK_START_DAY) - 1);
// Label workWeekBeginLabel = new Label(group, SWT.NONE);

Back to the top