diff options
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); |