Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaxsun McCarthy Huggan2016-08-17 21:26:25 -0400
committerJaxsun McCarthy Huggan2016-08-18 13:34:44 -0400
commitf53818a10879eb46747383a6a533845c6e037cf2 (patch)
treebd8ef55f7a5a82f59ea2f26b81f0c578f7e6e881
parente78fe8eb59066c70f100188e416bb96dd329f761 (diff)
downloadorg.eclipse.mylyn.tasks-f53818a10879eb46747383a6a533845c6e037cf2.tar.gz
org.eclipse.mylyn.tasks-f53818a10879eb46747383a6a533845c6e037cf2.tar.xz
org.eclipse.mylyn.tasks-f53818a10879eb46747383a6a533845c6e037cf2.zip
158461: users can configure when to schedule new tasks
Change-Id: I892587aafd47c1802914bfcb94f7367a863e034c Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=158461
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskActivityManager.java5
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/NewTaskWizardRepositorySelectionTest.java7
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ITasksUiPreferenceConstants.java12
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java60
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewSubTaskAction.java32
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/preferences/Messages.java10
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/preferences/TasksUiPreferencePage.java168
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/preferences/messages.properties5
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiInternal.java37
9 files changed, 202 insertions, 134 deletions
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 038209bec..ce1215e9a 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
@@ -867,10 +867,9 @@ public class TaskActivityManager implements ITaskActivityManager2 {
return false;
}
- public void scheduleNewTask(AbstractTask newTask) {
+ public void scheduleNewTask(AbstractTask newTask, DateRange scheduleFor) {
newTask.setCreationDate(new Date());
- // TODO: set based on preference? see bug#158461
- setScheduledFor(newTask, TaskActivityUtil.getCurrentWeek());
+ setScheduledFor(newTask, scheduleFor);
}
public boolean isDueThisWeek(ITask task) {
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/NewTaskWizardRepositorySelectionTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/NewTaskWizardRepositorySelectionTest.java
index 80f6584c1..cddbfb3e2 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/NewTaskWizardRepositorySelectionTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/NewTaskWizardRepositorySelectionTest.java
@@ -11,12 +11,11 @@
package org.eclipse.mylyn.tasks.tests;
-import junit.framework.TestCase;
-
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.mylyn.internal.tasks.core.LocalRepositoryConnector;
+import org.eclipse.mylyn.internal.tasks.core.TaskActivityUtil;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
@@ -30,6 +29,8 @@ import org.eclipse.mylyn.tasks.ui.wizards.NewTaskWizard;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
+import junit.framework.TestCase;
+
/**
* @author Mik Kersten
*/
@@ -44,7 +45,7 @@ public class NewTaskWizardRepositorySelectionTest extends TestCase {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
TaskListView view = (TaskListView) TasksUiUtil.openTasksViewInActivePerspective();
MockTask mockTask = new MockTask("mock.task");
- TasksUiPlugin.getTaskActivityManager().scheduleNewTask(mockTask);
+ TasksUiPlugin.getTaskActivityManager().scheduleNewTask(mockTask, TaskActivityUtil.getCurrentWeek());
TasksUiPlugin.getTaskList().addTask(mockTask);
view.setFocusedMode(true);
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ITasksUiPreferenceConstants.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ITasksUiPreferenceConstants.java
index 69006a6fc..1f2fae768 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ITasksUiPreferenceConstants.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ITasksUiPreferenceConstants.java
@@ -64,6 +64,16 @@ public interface ITasksUiPreferenceConstants {
public static final String WEEK_START_DAY = "org.eclipse.mylyn.tasks.ui.planning.week.start.day"; //$NON-NLS-1$
+ public static final String SCHEDULE_NEW_TASKS_FOR = "org.eclipse.mylyn.tasks.ui.planning.schedule.new.tasks.for"; //$NON-NLS-1$
+
+ public static final String SCHEDULE_NEW_TASKS_FOR_THIS_WEEK = "org.eclipse.mylyn.tasks.ui.planning.schedule.new.tasks.for.this.week"; //$NON-NLS-1$
+
+ public static final String SCHEDULE_NEW_TASKS_FOR_TOMORROW = "org.eclipse.mylyn.tasks.ui.planning.schedule.new.tasks.for.tomorrow"; //$NON-NLS-1$
+
+ public static final String SCHEDULE_NEW_TASKS_FOR_TODAY = "org.eclipse.mylyn.tasks.ui.planning.schedule.new.tasks.for.today"; //$NON-NLS-1$
+
+ public static final String SCHEDULE_NEW_TASKS_FOR_NOT_SCHEDULED = "org.eclipse.mylyn.tasks.ui.planning.schedule.new.tasks.for.unscheduled"; //$NON-NLS-1$
+
public static final String PLANNING_ENDHOUR = "org.eclipse.mylyn.tasks.ui.planning.end.hour"; //$NON-NLS-1$
public static final String EDITOR_TASKS_RICH = "org.eclipse.mylyn.tasks.ui.reporting.open.editor"; //$NON-NLS-1$
@@ -86,7 +96,7 @@ public interface ITasksUiPreferenceConstants {
/**
* Local subtasks are now enabled by default.
- *
+ *
* @deprecated not used anymore
*/
// TODO 4.0 remove
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java
index 5462e32ec..4c59f56b4 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java
@@ -128,7 +128,7 @@ import org.osgi.util.tracker.ServiceTracker;
/**
* Main entry point for the Tasks UI.
- *
+ *
* @author Mik Kersten
* @since 3.0
*/
@@ -198,7 +198,8 @@ public class TasksUiPlugin extends AbstractUIPlugin {
private final List<AbstractSearchHandler> searchHandlers = new ArrayList<AbstractSearchHandler>();
- private static final boolean DEBUG_HTTPCLIENT = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.mylyn.tasks.ui/debug/httpclient")); //$NON-NLS-1$ //$NON-NLS-2$
+ private static final boolean DEBUG_HTTPCLIENT = "true" //$NON-NLS-1$
+ .equalsIgnoreCase(Platform.getDebugOption("org.eclipse.mylyn.tasks.ui/debug/httpclient")); //$NON-NLS-1$
// XXX reconsider if this is necessary
public static class TasksUiStartup implements IStartup {
@@ -383,8 +384,8 @@ public class TasksUiPlugin extends AbstractUIPlugin {
//taskActivityMonitor.reloadActivityTime();
} catch (Throwable t) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Could not initialize task activity", t)); //$NON-NLS-1$
+ StatusHandler.log(
+ new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Could not initialize task activity", t)); //$NON-NLS-1$
}
monitor.worked(1);
@@ -427,7 +428,8 @@ public class TasksUiPlugin extends AbstractUIPlugin {
@Override
public boolean openLink(String link) {
if (HIDE_SUBTASKS.equals(link)) {
- getPreferenceStore().setValue(ITasksUiPreferenceConstants.FILTER_NON_MATCHING, true);
+ getPreferenceStore().setValue(ITasksUiPreferenceConstants.FILTER_NON_MATCHING,
+ true);
savePluginPreferences();
return true;
}
@@ -436,8 +438,8 @@ public class TasksUiPlugin extends AbstractUIPlugin {
};
message.setImage(Dialog.DLG_IMG_MESSAGE_INFO);
message.setTitle(Messages.TasksUiPlugin_Hide_Irrelevant_Subtasks);
- message.setDescription(NLS.bind(Messages.TasksUiPlugin_Hide_Irrelevant_Subtasks_Message,
- HIDE_SUBTASKS));
+ message.setDescription(
+ NLS.bind(Messages.TasksUiPlugin_Hide_Irrelevant_Subtasks_Message, HIDE_SUBTASKS));
view.getServiceMessageControl().setMessage(message);
}
}
@@ -624,8 +626,8 @@ public class TasksUiPlugin extends AbstractUIPlugin {
// make this available early for clients that are not initialized through tasks ui but need access
taskListNotificationManager = new TaskListNotificationManager();
- String lastMod = getPreferenceStore().getString(
- ITasksUiPreferenceConstants.LAST_SERVICE_MESSAGE_LAST_MODIFIED);
+ String lastMod = getPreferenceStore()
+ .getString(ITasksUiPreferenceConstants.LAST_SERVICE_MESSAGE_LAST_MODIFIED);
String etag = getPreferenceStore().getString(ITasksUiPreferenceConstants.LAST_SERVICE_MESSAGE_ETAG);
String serviceMessageUrl = getPreferenceStore().getString(ITasksUiPreferenceConstants.SERVICE_MESSAGE_URL);
@@ -665,8 +667,8 @@ public class TasksUiPlugin extends AbstractUIPlugin {
final boolean force = Boolean.parseBoolean(System.getProperty(PROP_FORCE_CREDENTIALS_MIGRATION));
final boolean migrateFromSecureStore = force
|| !getPluginPreferences().getBoolean(PREF_MIGRATED_TASK_REPOSITORIES_FROM_SECURE_STORE);
- final boolean migrateFromKeyring = (force || !getPluginPreferences().getBoolean(
- PREF_MIGRATED_TASK_REPOSITORIES_FROM_KEYRING))
+ final boolean migrateFromKeyring = (force
+ || !getPluginPreferences().getBoolean(PREF_MIGRATED_TASK_REPOSITORIES_FROM_KEYRING))
&& isKeyringInstalled();
if (!migrateFromSecureStore && !migrateFromKeyring) {
return;
@@ -742,7 +744,8 @@ public class TasksUiPlugin extends AbstractUIPlugin {
// Add the automatically created templates
for (AbstractRepositoryConnector connector : repositoryManager.getRepositoryConnectors()) {
for (RepositoryTemplate template : repositoryTemplateManager.getTemplates(connector.getConnectorKind())) {
- if (template.addAutomatically && !TaskRepositoryUtil.isAddAutomaticallyDisabled(template.repositoryUrl)) {
+ if (template.addAutomatically
+ && !TaskRepositoryUtil.isAddAutomaticallyDisabled(template.repositoryUrl)) {
try {
String repositoryUrl = TaskRepositoryManager.stripSlashes(template.repositoryUrl);
TaskRepository taskRepository = repositoryManager.getRepository(connector.getConnectorKind(),
@@ -753,8 +756,8 @@ public class TasksUiPlugin extends AbstractUIPlugin {
taskRepository.setRepositoryLabel(template.label);
taskRepository.setCharacterEncoding(template.characterEncoding);
if (template.anonymous) {
- taskRepository.setProperty(
- "org.eclipse.mylyn.tasklist.repositories.enabled", String.valueOf(false)); //$NON-NLS-1$
+ taskRepository.setProperty("org.eclipse.mylyn.tasklist.repositories.enabled", //$NON-NLS-1$
+ String.valueOf(false));
// bug 332747: avoid reseting password in shared keystore
//taskRepository.setCredentials(AuthenticationType.REPOSITORY, null, true);
}
@@ -774,7 +777,7 @@ public class TasksUiPlugin extends AbstractUIPlugin {
/**
* Returns the local task repository. If the repository does not exist it is created and added to the task
* repository manager.
- *
+ *
* @return the local task repository; never <code>null</code>
* @since 3.0
*/
@@ -844,8 +847,8 @@ public class TasksUiPlugin extends AbstractUIPlugin {
INSTANCE = null;
}
} catch (Exception e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Task list stop terminated abnormally", e)); //$NON-NLS-1$
+ StatusHandler
+ .log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Task list stop terminated abnormally", e)); //$NON-NLS-1$
} finally {
super.stop(context);
}
@@ -864,7 +867,7 @@ public class TasksUiPlugin extends AbstractUIPlugin {
* Persist <code>path</code> as data directory and loads data from <code>path</code>. This method may block if other
* jobs are running that modify tasks data. This method will only execute after all conflicting jobs have been
* completed.
- *
+ *
* @throws CoreException
* in case setting of the data directory did not complete normally
* @throws OperationCanceledException
@@ -950,9 +953,8 @@ public class TasksUiPlugin extends AbstractUIPlugin {
.getBoolean(MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED + ".checked")) { //$NON-NLS-1$
if (!taskActivityMonitor.getActivationHistory().isEmpty()) {
// tasks have been active before so fore preference enabled
- MonitorUiPlugin.getDefault()
- .getPreferenceStore()
- .setValue(MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED, true);
+ MonitorUiPlugin.getDefault().getPreferenceStore().setValue(MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED,
+ true);
}
MonitorUiPlugin.getDefault()
.getPreferenceStore()
@@ -994,7 +996,6 @@ public class TasksUiPlugin extends AbstractUIPlugin {
store.setDefault(ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED, true);
store.setDefault(ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_MILISECONDS, "" + (20 * 60 * 1000)); //$NON-NLS-1$
- //store.setDefault(TasksUiPreferenceConstants.BACKUP_SCHEDULE, 1);
store.setDefault(ITasksUiPreferenceConstants.BACKUP_MAXFILES, 20);
store.setDefault(ITasksUiPreferenceConstants.BACKUP_LAST, 0f);
@@ -1004,7 +1005,8 @@ public class TasksUiPlugin extends AbstractUIPlugin {
store.setValue(ITasksUiPreferenceConstants.ACTIVATE_MULTIPLE, false);
store.setDefault(ITasksUiPreferenceConstants.WEEK_START_DAY, Calendar.getInstance().getFirstDayOfWeek());
- //store.setDefault(TasksUiPreferenceConstants.PLANNING_STARTHOUR, 9);
+ store.setDefault(ITasksUiPreferenceConstants.SCHEDULE_NEW_TASKS_FOR,
+ ITasksUiPreferenceConstants.SCHEDULE_NEW_TASKS_FOR_THIS_WEEK);
store.setDefault(ITasksUiPreferenceConstants.PLANNING_ENDHOUR, 18);
store.setDefault(ITasksUiPreferenceConstants.AUTO_EXPAND_TASK_LIST, true);
@@ -1034,7 +1036,8 @@ public class TasksUiPlugin extends AbstractUIPlugin {
.getBoolean(ITasksUiPreferenceConstants.GROUP_SUBTASKS);
if (element instanceof ITask) {
- AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(((ITask) element).getConnectorKind());
+ AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin
+ .getConnectorUi(((ITask) element).getConnectorKind());
if (connectorUi != null) {
if (connectorUi.hasStrictSubtaskHierarchy()) {
groupSubtasks = true;
@@ -1043,7 +1046,8 @@ public class TasksUiPlugin extends AbstractUIPlugin {
}
if (element instanceof IRepositoryQuery) {
- AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(((IRepositoryQuery) element).getConnectorKind());
+ AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin
+ .getConnectorUi(((IRepositoryQuery) element).getConnectorKind());
if (connectorUi != null) {
if (connectorUi.hasStrictSubtaskHierarchy()) {
groupSubtasks = true;
@@ -1278,7 +1282,7 @@ public class TasksUiPlugin extends AbstractUIPlugin {
/**
* Associate a Task Repository with a workbench project
- *
+ *
* @param resource
* project or resource belonging to a project
* @param repository
@@ -1435,8 +1439,8 @@ public class TasksUiPlugin extends AbstractUIPlugin {
taskListNotificationManager.startNotification(NOTIFICATION_DELAY);
getPreferenceStore().addPropertyChangeListener(taskListNotificationManager);
} catch (Throwable t) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Could not initialize notifications", t)); //$NON-NLS-1$
+ StatusHandler
+ .log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Could not initialize notifications", t)); //$NON-NLS-1$
}
try {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewSubTaskAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewSubTaskAction.java
index ba0ad5f13..9a79613c7 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewSubTaskAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewSubTaskAction.java
@@ -79,14 +79,14 @@ public class NewSubTaskAction extends BaseSelectionListenerAction implements IVi
LocalTask newTask = new LocalTask("" + taskList.getNextLocalTaskId(), //$NON-NLS-1$
LocalRepositoryConnector.DEFAULT_SUMMARY);
newTask.setPriority(PriorityLevel.P3.toString());
- TasksUiPlugin.getTaskActivityManager().scheduleNewTask(newTask);
+ TasksUiInternal.scheduleNewTask(newTask);
taskList.addTask(newTask, selectedTask);
TasksUiUtil.openTask(newTask);
return;
}
- AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
- selectedTask.getConnectorKind());
+ AbstractRepositoryConnector connector = TasksUi.getRepositoryManager()
+ .getRepositoryConnector(selectedTask.getConnectorKind());
IWizard wizard = getNewSubTaskWizard();
if (wizard != null) {
WizardDialog dialog = new WizardDialog(WorkbenchUtil.getShell(), wizard);
@@ -100,9 +100,9 @@ public class NewSubTaskAction extends BaseSelectionListenerAction implements IVi
TasksUiInternal.createAndOpenNewTask(taskData);
} catch (CoreException e) {
StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Failed to open new sub task", e)); //$NON-NLS-1$
- TasksUiInternal.displayStatus(Messages.NewSubTaskAction_Unable_to_create_subtask, new Status(
- IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- Messages.NewSubTaskAction_Failed_to_create_new_sub_task_ + e.getMessage()));
+ TasksUiInternal.displayStatus(Messages.NewSubTaskAction_Unable_to_create_subtask,
+ new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
+ Messages.NewSubTaskAction_Failed_to_create_new_sub_task_ + e.getMessage()));
}
}
}
@@ -129,9 +129,9 @@ public class NewSubTaskAction extends BaseSelectionListenerAction implements IVi
"Could not retrieve task data for task:" + selectedTask.getUrl(), e)); //$NON-NLS-1$
}
if (parentTaskData == null) {
- TasksUiInternal.displayStatus(Messages.NewSubTaskAction_Unable_to_create_subtask, new Status(
- IStatus.WARNING, TasksUiPlugin.ID_PLUGIN,
- Messages.NewSubTaskAction_Could_not_retrieve_task_data_for_task_ + selectedTask.getUrl()));
+ TasksUiInternal.displayStatus(Messages.NewSubTaskAction_Unable_to_create_subtask,
+ new Status(IStatus.WARNING, TasksUiPlugin.ID_PLUGIN,
+ Messages.NewSubTaskAction_Could_not_retrieve_task_data_for_task_ + selectedTask.getUrl()));
return null;
}
@@ -165,9 +165,9 @@ public class NewSubTaskAction extends BaseSelectionListenerAction implements IVi
// open editor
return taskData;
} else {
- TasksUiInternal.displayStatus(Messages.NewSubTaskAction_Unable_to_create_subtask, new Status(IStatus.INFO,
- TasksUiPlugin.ID_PLUGIN,
- Messages.NewSubTaskAction_The_connector_does_not_support_creating_subtasks_for_this_task));
+ TasksUiInternal.displayStatus(Messages.NewSubTaskAction_Unable_to_create_subtask,
+ new Status(IStatus.INFO, TasksUiPlugin.ID_PLUGIN,
+ Messages.NewSubTaskAction_The_connector_does_not_support_creating_subtasks_for_this_task));
}
return null;
}
@@ -188,12 +188,12 @@ public class NewSubTaskAction extends BaseSelectionListenerAction implements IVi
selectedTask = (AbstractTask) selectedObject;
} else if (selectedObject instanceof ITask) {
selectedTask = (AbstractTask) selectedObject;
- AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
- selectedTask.getConnectorKind());
+ AbstractRepositoryConnector connector = TasksUi.getRepositoryManager()
+ .getRepositoryConnector(selectedTask.getConnectorKind());
AbstractTaskDataHandler taskDataHandler = connector.getTaskDataHandler();
- TaskRepository repository = TasksUiPlugin.getRepositoryManager().getRepository(
- selectedTask.getRepositoryUrl());
+ TaskRepository repository = TasksUiPlugin.getRepositoryManager()
+ .getRepository(selectedTask.getRepositoryUrl());
if (taskDataHandler == null || !taskDataHandler.canInitializeSubTaskData(repository, selectedTask)) {
selectedTask = null;
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/preferences/Messages.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/preferences/Messages.java
index e8279059c..e41578c7c 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/preferences/Messages.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/preferences/Messages.java
@@ -69,6 +69,8 @@ public class Messages extends NLS {
public static String TasksUiPreferencePage_Rich_Editor__Recommended_;
+ public static String TasksUiPreferencePage_ScheduleNewTasks;
+
public static String TasksUiPreferencePage_Scheduling;
public static String TasksUiPreferencePage_See_X_for_configuring_Task_List_colors;
@@ -101,8 +103,16 @@ public class Messages extends NLS {
public static String TasksUiPreferencePage_Task_Timing;
+ public static String TasksUiPreferencePage_ThisWeek;
+
+ public static String TasksUiPreferencePage_Today;
+
+ public static String TasksUiPreferencePage_Tomorrow;
+
public static String TasksUiPreferencePage_Track_Time_Spent;
+ public static String TasksUiPreferencePage_Unscheduled;
+
public static String TasksUiPreferencePage_Use_the_Restore_dialog_to_recover_missing_tasks;
public static String TasksUiPreferencePage_Web_Browser;
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 09b4fef3d..bb806358e 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
@@ -60,6 +60,10 @@ import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Hyperlink;
import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
+import com.google.common.collect.BiMap;
+import com.google.common.collect.HashBiMap;
+import com.google.common.collect.ImmutableMap;
+
/**
* @author Mik Kersten
* @author Rob Elves
@@ -75,6 +79,12 @@ public class TasksUiPreferencePage extends PreferencePage implements IWorkbenchP
private static final int MS_MINUTES = 60 * 1000;
+ private static BiMap<String, Integer> SCHEDULE_TIME_MAP = HashBiMap
+ .create(ImmutableMap.of(ITasksUiPreferenceConstants.SCHEDULE_NEW_TASKS_FOR_THIS_WEEK, 0,
+ ITasksUiPreferenceConstants.SCHEDULE_NEW_TASKS_FOR_TOMORROW, 1,
+ ITasksUiPreferenceConstants.SCHEDULE_NEW_TASKS_FOR_TODAY, 2,
+ ITasksUiPreferenceConstants.SCHEDULE_NEW_TASKS_FOR_NOT_SCHEDULED, 3));
+
private Button useRichEditor;
private Button editorHighlightsCurrentLine;
@@ -101,6 +111,8 @@ public class TasksUiPreferencePage extends PreferencePage implements IWorkbenchP
private Combo weekStartCombo;
+ private Combo scheduleNewTasksCombo;
+
private Button activityTrackingEnabledButton;
private Label timeoutLabel1;
@@ -177,8 +189,8 @@ public class TasksUiPreferencePage extends PreferencePage implements IWorkbenchP
}
private Composite createAdvancedSection(Composite container) {
- advancedComposite = toolkit.createExpandableComposite(container, ExpandableComposite.COMPACT
- | ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR);
+ advancedComposite = toolkit.createExpandableComposite(container,
+ ExpandableComposite.COMPACT | ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR);
advancedComposite.setFont(container.getFont());
advancedComposite.setBackground(container.getBackground());
advancedComposite.setText(Messages.TasksUiPreferencePage_Advanced);
@@ -205,7 +217,6 @@ public class TasksUiPreferencePage extends PreferencePage implements IWorkbenchP
public boolean performOk() {
getPreferenceStore().setValue(ITasksUiPreferenceConstants.NOTIFICATIONS_ENABLED,
notificationEnabledButton.getSelection());
- //getPreferenceStore().setValue(TasksUiPreferenceConstants.BACKUP_SCHEDULE, backupScheduleTimeText.getText());
getPreferenceStore().setValue(ITasksUiPreferenceConstants.EDITOR_TASKS_RICH, useRichEditor.getSelection());
getPreferenceStore().setValue(ITasksUiPreferenceConstants.EDITOR_CURRENT_LINE_HIGHLIGHT,
@@ -223,18 +234,15 @@ public class TasksUiPreferencePage extends PreferencePage implements IWorkbenchP
getPreferenceStore().setValue(ITasksUiPreferenceConstants.SHOW_TRIM, showTaskTrimButton.getSelection());
getPreferenceStore().setValue(ITasksUiPreferenceConstants.WEEK_START_DAY, getWeekStartValue());
- //getPreferenceStore().setValue(TasksUiPreferenceConstants.PLANNING_STARTHOUR, hourDayStart.getSelection());
-// getPreferenceStore().setValue(TasksUiPreferenceConstants.PLANNING_ENDHOUR, hourDayEnd.getSelection());
- MonitorUiPlugin.getDefault()
- .getPreferenceStore()
- .setValue(ActivityContextManager.ACTIVITY_TIMEOUT_ENABLED, timeoutEnabledButton.getSelection());
- MonitorUiPlugin.getDefault()
- .getPreferenceStore()
- .setValue(ActivityContextManager.ACTIVITY_TIMEOUT, timeoutMinutes.getSelection() * (60 * 1000));
+ getPreferenceStore().setValue(ITasksUiPreferenceConstants.SCHEDULE_NEW_TASKS_FOR, getScheduleNewTasksValue());
- MonitorUiPlugin.getDefault()
- .getPreferenceStore()
- .setValue(MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED, activityTrackingEnabledButton.getSelection());
+ MonitorUiPlugin.getDefault().getPreferenceStore().setValue(ActivityContextManager.ACTIVITY_TIMEOUT_ENABLED,
+ timeoutEnabledButton.getSelection());
+ MonitorUiPlugin.getDefault().getPreferenceStore().setValue(ActivityContextManager.ACTIVITY_TIMEOUT,
+ timeoutMinutes.getSelection() * (60 * 1000));
+
+ MonitorUiPlugin.getDefault().getPreferenceStore().setValue(MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED,
+ activityTrackingEnabledButton.getSelection());
String taskDirectory = taskDirectoryText.getText();
taskDirectory = taskDirectory.replaceAll(BACKSLASH_MULTI, FORWARDSLASH);
@@ -272,34 +280,35 @@ public class TasksUiPreferencePage extends PreferencePage implements IWorkbenchP
return weekStartCombo.getSelectionIndex() + 1;
}
+ private String getScheduleNewTasksValue() {
+ int index = scheduleNewTasksCombo.getSelectionIndex();
+ return SCHEDULE_TIME_MAP.inverse().get(index);
+ }
+
@Override
public boolean performCancel() {
taskDirectoryText.setText(TasksUiPlugin.getDefault().getDefaultDataDirectory());
- notificationEnabledButton.setSelection(getPreferenceStore().getBoolean(
- ITasksUiPreferenceConstants.NOTIFICATIONS_ENABLED));
- //backupScheduleTimeText.setText(getPreferenceStore().getString(TasksUiPreferenceConstants.BACKUP_SCHEDULE));
- //backupFolderText.setText(TasksUiPlugin.getDefault().getBackupFolderPath());
+ notificationEnabledButton
+ .setSelection(getPreferenceStore().getBoolean(ITasksUiPreferenceConstants.NOTIFICATIONS_ENABLED));
useRichEditor.setSelection(getPreferenceStore().getBoolean(ITasksUiPreferenceConstants.EDITOR_TASKS_RICH));
- editorHighlightsCurrentLine.setSelection(getPreferenceStore().getBoolean(
- ITasksUiPreferenceConstants.EDITOR_CURRENT_LINE_HIGHLIGHT));
+ editorHighlightsCurrentLine.setSelection(
+ getPreferenceStore().getBoolean(ITasksUiPreferenceConstants.EDITOR_CURRENT_LINE_HIGHLIGHT));
- // synchQueries.setSelection(getPreferenceStore().getBoolean(
- // TaskListPreferenceConstants.REPOSITORY_SYNCH_ON_STARTUP));
- enableBackgroundSynch.setSelection(getPreferenceStore().getBoolean(
- ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED));
+ enableBackgroundSynch.setSelection(
+ getPreferenceStore().getBoolean(ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED));
synchScheduleTime.setText(getMinutesString());
- taskListTooltipEnabledButton.setSelection(getPreferenceStore().getBoolean(
- ITasksUiPreferenceConstants.TASK_LIST_TOOL_TIPS_ENABLED));
- taskListServiceMessageEnabledButton.setSelection(getPreferenceStore().getBoolean(
- ITasksUiPreferenceConstants.SERVICE_MESSAGES_ENABLED));
+ taskListTooltipEnabledButton
+ .setSelection(getPreferenceStore().getBoolean(ITasksUiPreferenceConstants.TASK_LIST_TOOL_TIPS_ENABLED));
+ taskListServiceMessageEnabledButton
+ .setSelection(getPreferenceStore().getBoolean(ITasksUiPreferenceConstants.SERVICE_MESSAGES_ENABLED));
showTaskTrimButton.setSelection(getPreferenceStore().getBoolean(ITasksUiPreferenceConstants.SHOW_TRIM));
weekStartCombo.select(getPreferenceStore().getInt(ITasksUiPreferenceConstants.WEEK_START_DAY) - 1);
- //hourDayStart.setSelection(getPreferenceStore().getInt(TasksUiPreferenceConstants.PLANNING_STARTHOUR));
-// hourDayEnd.setSelection(getPreferenceStore().getInt(TasksUiPreferenceConstants.PLANNING_ENDHOUR));
-//backupNow.setEnabled(true);
+ String scheduleFor = getPreferenceStore().getString(ITasksUiPreferenceConstants.SCHEDULE_NEW_TASKS_FOR);
+ scheduleNewTasksCombo.select(SCHEDULE_TIME_MAP.getOrDefault(scheduleFor, 0));
+
int minutes = MonitorUiPlugin.getDefault().getPreferenceStore().getInt(ActivityContextManager.ACTIVITY_TIMEOUT)
/ MS_MINUTES;
timeoutMinutes.setSelection(minutes);
@@ -318,39 +327,36 @@ public class TasksUiPreferencePage extends PreferencePage implements IWorkbenchP
public void performDefaults() {
super.performDefaults();
taskDirectoryText.setText(TasksUiPlugin.getDefault().getDefaultDataDirectory());
-// backupFolderText.setText(taskDirectory + FORWARDSLASH + ITasksCoreConstants.DEFAULT_BACKUP_FOLDER_NAME);
-// backupNow.setEnabled(true);
- notificationEnabledButton.setSelection(getPreferenceStore().getDefaultBoolean(
- ITasksUiPreferenceConstants.NOTIFICATIONS_ENABLED));
- //backupScheduleTimeText.setText(getPreferenceStore().getDefaultString(TasksUiPreferenceConstants.BACKUP_SCHEDULE));
+ notificationEnabledButton.setSelection(
+ getPreferenceStore().getDefaultBoolean(ITasksUiPreferenceConstants.NOTIFICATIONS_ENABLED));
- useRichEditor.setSelection(getPreferenceStore().getDefaultBoolean(ITasksUiPreferenceConstants.EDITOR_TASKS_RICH));
- editorHighlightsCurrentLine.setSelection(getPreferenceStore().getDefaultBoolean(
- ITasksUiPreferenceConstants.EDITOR_CURRENT_LINE_HIGHLIGHT));
+ useRichEditor
+ .setSelection(getPreferenceStore().getDefaultBoolean(ITasksUiPreferenceConstants.EDITOR_TASKS_RICH));
+ editorHighlightsCurrentLine.setSelection(
+ getPreferenceStore().getDefaultBoolean(ITasksUiPreferenceConstants.EDITOR_CURRENT_LINE_HIGHLIGHT));
- taskListTooltipEnabledButton.setSelection(getPreferenceStore().getDefaultBoolean(
- ITasksUiPreferenceConstants.TASK_LIST_TOOL_TIPS_ENABLED));
- taskListServiceMessageEnabledButton.setSelection(getPreferenceStore().getDefaultBoolean(
- ITasksUiPreferenceConstants.SERVICE_MESSAGES_ENABLED));
+ taskListTooltipEnabledButton.setSelection(
+ getPreferenceStore().getDefaultBoolean(ITasksUiPreferenceConstants.TASK_LIST_TOOL_TIPS_ENABLED));
+ taskListServiceMessageEnabledButton.setSelection(
+ getPreferenceStore().getDefaultBoolean(ITasksUiPreferenceConstants.SERVICE_MESSAGES_ENABLED));
showTaskTrimButton.setSelection(getPreferenceStore().getDefaultBoolean(ITasksUiPreferenceConstants.SHOW_TRIM));
- // synchQueries.setSelection(getPreferenceStore().getDefaultBoolean(
- // TaskListPreferenceConstants.REPOSITORY_SYNCH_ON_STARTUP));
- enableBackgroundSynch.setSelection(getPreferenceStore().getDefaultBoolean(
- ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED));
- // userRefreshOnly.setSelection(!enableBackgroundSynch.getSelection());
- long miliseconds = getPreferenceStore().getDefaultLong(
- ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_MILISECONDS);
+ enableBackgroundSynch.setSelection(
+ getPreferenceStore().getDefaultBoolean(ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED));
+ long miliseconds = getPreferenceStore()
+ .getDefaultLong(ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_MILISECONDS);
long minutes = miliseconds / 60000;
synchScheduleTime.setText("" + minutes); //$NON-NLS-1$
+
weekStartCombo.select(getPreferenceStore().getDefaultInt(ITasksUiPreferenceConstants.WEEK_START_DAY) - 1);
- // hourDayStart.setSelection(getPreferenceStore().getDefaultInt(TasksUiPreferenceConstants.PLANNING_STARTHOUR));
-// hourDayEnd.setSelection(getPreferenceStore().getDefaultInt(TasksUiPreferenceConstants.PLANNING_ENDHOUR));
+ String defaultScheduleFor = getPreferenceStore()
+ .getDefaultString(ITasksUiPreferenceConstants.SCHEDULE_NEW_TASKS_FOR);
+ scheduleNewTasksCombo.select(SCHEDULE_TIME_MAP.getOrDefault(defaultScheduleFor, 0));
+
int activityTimeoutMinutes = MonitorUiPlugin.getDefault()
.getPreferenceStore()
- .getDefaultInt(ActivityContextManager.ACTIVITY_TIMEOUT)
- / MS_MINUTES;
+ .getDefaultInt(ActivityContextManager.ACTIVITY_TIMEOUT) / MS_MINUTES;
timeoutMinutes.setSelection(activityTimeoutMinutes);
timeoutEnabledButton.setSelection(MonitorUiPlugin.getDefault()
.getPreferenceStore()
@@ -377,8 +383,8 @@ public class TasksUiPreferencePage extends PreferencePage implements IWorkbenchP
enableSynch.setLayout(gridLayout);
enableBackgroundSynch = new Button(enableSynch, SWT.CHECK);
enableBackgroundSynch.setText(Messages.TasksUiPreferencePage_Synchronize_with_repositories_every);
- enableBackgroundSynch.setSelection(getPreferenceStore().getBoolean(
- ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED));
+ enableBackgroundSynch.setSelection(
+ getPreferenceStore().getBoolean(ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED));
enableBackgroundSynch.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
updateRefreshGroupEnablements();
@@ -401,9 +407,10 @@ public class TasksUiPreferencePage extends PreferencePage implements IWorkbenchP
label.setText(Messages.TasksUiPreferencePage_minutes);
notificationEnabledButton = new Button(group, SWT.CHECK);
- notificationEnabledButton.setText(Messages.TasksUiPreferencePage_Display_notifications_for_overdue_tasks_and_incoming_changes);
- notificationEnabledButton.setSelection(getPreferenceStore().getBoolean(
- ITasksUiPreferenceConstants.NOTIFICATIONS_ENABLED));
+ notificationEnabledButton
+ .setText(Messages.TasksUiPreferencePage_Display_notifications_for_overdue_tasks_and_incoming_changes);
+ notificationEnabledButton
+ .setSelection(getPreferenceStore().getBoolean(ITasksUiPreferenceConstants.NOTIFICATIONS_ENABLED));
}
@@ -422,8 +429,8 @@ public class TasksUiPreferencePage extends PreferencePage implements IWorkbenchP
editorHighlightsCurrentLine = new Button(container, SWT.CHECK);
editorHighlightsCurrentLine.setText(Messages.TasksUiPreferencePage_highlight_current_line);
- editorHighlightsCurrentLine.setSelection(getPreferenceStore().getBoolean(
- ITasksUiPreferenceConstants.EDITOR_CURRENT_LINE_HIGHLIGHT));
+ editorHighlightsCurrentLine.setSelection(
+ getPreferenceStore().getBoolean(ITasksUiPreferenceConstants.EDITOR_CURRENT_LINE_HIGHLIGHT));
}
private void createTaskDataControl(Composite parent) {
@@ -477,16 +484,12 @@ public class TasksUiPreferencePage extends PreferencePage implements IWorkbenchP
private void createSchedulingGroup(Composite container) {
Group group = new Group(container, SWT.SHADOW_ETCHED_IN);
group.setText(Messages.TasksUiPreferencePage_Scheduling);
- group.setLayout(new GridLayout(5, false));
+ group.setLayout(new GridLayout(2, false));
group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Label weekStartLabel = new Label(group, SWT.NONE);
weekStartLabel.setText(Messages.TasksUiPreferencePage_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(CommonMessages.Sunday);
weekStartCombo.add(CommonMessages.Monday);
weekStartCombo.add(CommonMessages.Tuesday);
@@ -496,6 +499,15 @@ public class TasksUiPreferencePage extends PreferencePage implements IWorkbenchP
weekStartCombo.add(CommonMessages.Saturday);
weekStartCombo.select(getPreferenceStore().getInt(ITasksUiPreferenceConstants.WEEK_START_DAY) - 1);
+ Label scheduleNewTasksLabel = new Label(group, SWT.NONE);
+ scheduleNewTasksLabel.setText(Messages.TasksUiPreferencePage_ScheduleNewTasks);
+ scheduleNewTasksCombo = new Combo(group, SWT.READ_ONLY);
+ scheduleNewTasksCombo.add(Messages.TasksUiPreferencePage_ThisWeek);
+ scheduleNewTasksCombo.add(Messages.TasksUiPreferencePage_Tomorrow);
+ scheduleNewTasksCombo.add(Messages.TasksUiPreferencePage_Today);
+ scheduleNewTasksCombo.add(Messages.TasksUiPreferencePage_Unscheduled);
+ String scheduleFor = getPreferenceStore().getString(ITasksUiPreferenceConstants.SCHEDULE_NEW_TASKS_FOR);
+ scheduleNewTasksCombo.select(SCHEDULE_TIME_MAP.getOrDefault(scheduleFor, 0));
}
private void createTaskNavigationGroup(Composite parent) {
@@ -518,13 +530,14 @@ public class TasksUiPreferencePage extends PreferencePage implements IWorkbenchP
taskListTooltipEnabledButton = new Button(group, SWT.CHECK);
taskListTooltipEnabledButton.setText(Messages.TasksUiPreferencePage_Show_tooltip_on_hover_Label);
- taskListTooltipEnabledButton.setSelection(getPreferenceStore().getBoolean(
- ITasksUiPreferenceConstants.TASK_LIST_TOOL_TIPS_ENABLED));
+ taskListTooltipEnabledButton
+ .setSelection(getPreferenceStore().getBoolean(ITasksUiPreferenceConstants.TASK_LIST_TOOL_TIPS_ENABLED));
taskListServiceMessageEnabledButton = new Button(group, SWT.CHECK);
- taskListServiceMessageEnabledButton.setText(Messages.TasksUiPreferencePage_Notification_for_new_connectors_available_Label);
- taskListServiceMessageEnabledButton.setSelection(getPreferenceStore().getBoolean(
- ITasksUiPreferenceConstants.SERVICE_MESSAGES_ENABLED));
+ taskListServiceMessageEnabledButton
+ .setText(Messages.TasksUiPreferencePage_Notification_for_new_connectors_available_Label);
+ taskListServiceMessageEnabledButton
+ .setSelection(getPreferenceStore().getBoolean(ITasksUiPreferenceConstants.SERVICE_MESSAGES_ENABLED));
}
private Group createTaskActivityGroup(Composite container) {
@@ -574,8 +587,7 @@ public class TasksUiPreferencePage extends PreferencePage implements IWorkbenchP
timeoutMinutes.setMinimum(1);
long minutes = MonitorUiPlugin.getDefault()
.getPreferenceStore()
- .getLong(ActivityContextManager.ACTIVITY_TIMEOUT)
- / MS_MINUTES;
+ .getLong(ActivityContextManager.ACTIVITY_TIMEOUT) / MS_MINUTES;
timeoutMinutes.setSelection((int) minutes);
timeoutMinutes.addSelectionListener(new SelectionAdapter() {
@@ -626,8 +638,8 @@ public class TasksUiPreferencePage extends PreferencePage implements IWorkbenchP
}
private String getMinutesString() {
- long miliseconds = getPreferenceStore().getLong(
- ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_MILISECONDS);
+ long miliseconds = getPreferenceStore()
+ .getLong(ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_MILISECONDS);
long minutes = miliseconds / 60000;
return "" + minutes; //$NON-NLS-1$
}
@@ -640,10 +652,8 @@ public class TasksUiPreferencePage extends PreferencePage implements IWorkbenchP
return false;
}
- MessageDialog dialogConfirm = new MessageDialog(
- null,
- Messages.TasksUiPreferencePage_Confirm_Task_List_data_directory_change,
- null,
+ MessageDialog dialogConfirm = new MessageDialog(null,
+ Messages.TasksUiPreferencePage_Confirm_Task_List_data_directory_change, null,
Messages.TasksUiPreferencePage_A_new_empty_Task_List_will_be_created_in_the_chosen_directory_if_one_does_not_already_exists,
MessageDialog.WARNING, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL },
IDialogConstants.CANCEL_ID);
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/preferences/messages.properties b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/preferences/messages.properties
index d1f9d9119..bdcb83592 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/preferences/messages.properties
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/preferences/messages.properties
@@ -30,6 +30,7 @@ TasksUiPreferencePage_Notification_for_new_connectors_available_Label=Display no
TasksUiPreferencePage_A_new_empty_Task_List_will_be_created_in_the_chosen_directory_if_one_does_not_already_exists=A new empty Task List will be created in the chosen directory if one does not already exists. Your previous directory and its contents will not be deleted.\n\nProceed?
TasksUiPreferencePage_highlight_current_line=Highlight current line
TasksUiPreferencePage_Rich_Editor__Recommended_=Rich Editor (Recommended)
+TasksUiPreferencePage_ScheduleNewTasks=Schedule New Tasks For:
TasksUiPreferencePage_Scheduling=Scheduling
TasksUiPreferencePage_See_X_for_configuring_Task_List_colors=See <a>''{0}''</a> for configuring Task List colors.
TasksUiPreferencePage_Show_active_task_trim_Button_Label=Show active task on window trim
@@ -46,7 +47,11 @@ TasksUiPreferencePage_Task_Editing=Task Editing
TasksUiPreferencePage_Task_List_Group=Task List
TasksUiPreferencePage_Task_Navigation_Group_Label=Task Navigation
TasksUiPreferencePage_Task_Timing=Time Tracking
+TasksUiPreferencePage_ThisWeek=This Week
+TasksUiPreferencePage_Today=Today
+TasksUiPreferencePage_Tomorrow=Tomorrow
TasksUiPreferencePage_Track_Time_Spent=Track time spent within Eclipse when a task is active
+TasksUiPreferencePage_Unscheduled=Unscheduled
TasksUiPreferencePage_Use_the_Restore_dialog_to_recover_missing_tasks=Use the Restore dialog to recover missing tasks
TasksUiPreferencePage_Web_Browser=Web Browser
TasksUiPreferencePage_Week_Start=Week Start:
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiInternal.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiInternal.java
index 611df11e4..1b6c107b0 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiInternal.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiInternal.java
@@ -69,12 +69,14 @@ import org.eclipse.mylyn.internal.monitor.ui.MonitorUiPlugin;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.internal.tasks.core.AbstractTaskCategory;
import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
+import org.eclipse.mylyn.internal.tasks.core.DateRange;
import org.eclipse.mylyn.internal.tasks.core.ITaskJobFactory;
import org.eclipse.mylyn.internal.tasks.core.ITaskList;
import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
import org.eclipse.mylyn.internal.tasks.core.LocalRepositoryConnector;
import org.eclipse.mylyn.internal.tasks.core.LocalTask;
import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
+import org.eclipse.mylyn.internal.tasks.core.TaskActivityUtil;
import org.eclipse.mylyn.internal.tasks.core.TaskCategory;
import org.eclipse.mylyn.internal.tasks.core.TaskList;
import org.eclipse.mylyn.internal.tasks.core.UncategorizedTaskContainer;
@@ -647,7 +649,7 @@ public class TasksUiInternal {
LocalTask newTask = new LocalTask("" + taskList.getNextLocalTaskId(), summary); //$NON-NLS-1$
newTask.setPriority(PriorityLevel.P3.toString());
TasksUiInternal.getTaskList().addTask(newTask);
- TasksUiPlugin.getTaskActivityManager().scheduleNewTask(newTask);
+ scheduleNewTask(newTask);
TaskListView view = TaskListView.getFromActivePerspective();
AbstractTaskCategory category = getSelectedCategory(view);
@@ -660,6 +662,33 @@ public class TasksUiInternal {
return newTask;
}
+ /**
+ * Schedules the new task according to the Tasks UI preferences
+ *
+ * @param newTask
+ * the task to schedule
+ */
+ public static void scheduleNewTask(LocalTask newTask) {
+ IPreferenceStore preferenceStore = TasksUiPlugin.getDefault().getPreferenceStore();
+ String preference = preferenceStore.getString(ITasksUiPreferenceConstants.SCHEDULE_NEW_TASKS_FOR);
+ DateRange dateRange = getNewTaskScheduleDateRange(preference);
+ TasksUiPlugin.getTaskActivityManager().scheduleNewTask(newTask, dateRange);
+ }
+
+ private static DateRange getNewTaskScheduleDateRange(String preference) {
+ switch (preference) {
+ case ITasksUiPreferenceConstants.SCHEDULE_NEW_TASKS_FOR_NOT_SCHEDULED:
+ return null;
+ case ITasksUiPreferenceConstants.SCHEDULE_NEW_TASKS_FOR_TODAY:
+ return TaskActivityUtil.getCurrentWeek().getToday();
+ case ITasksUiPreferenceConstants.SCHEDULE_NEW_TASKS_FOR_TOMORROW:
+ return TaskActivityUtil.getCurrentWeek().getToday().next();
+ case ITasksUiPreferenceConstants.SCHEDULE_NEW_TASKS_FOR_THIS_WEEK:
+ return TaskActivityUtil.getCurrentWeek();
+ }
+ return TaskActivityUtil.getCurrentWeek();
+ }
+
public static AbstractTaskCategory getSelectedCategory(TaskListView view) {
Object selectedObject = null;
if (view != null) {
@@ -1521,9 +1550,9 @@ public class TasksUiInternal {
showError = (query.getLastSynchronizedTimeStamp().equals("<never>") //$NON-NLS-1$
&& ((RepositoryStatus.ERROR_IO == query.getStatus().getCode() && exception != null
&& exception instanceof SocketTimeoutException) || //
- // only when we change SocketTimeout or Eclipse.org change there timeout for long running Queries
- (RepositoryStatus.ERROR_NETWORK) == query.getStatus().getCode()
- && query.getStatus().getMessage().equals("Http error: Internal Server Error"))); //$NON-NLS-1$
+ // only when we change SocketTimeout or Eclipse.org change there timeout for long running Queries
+ (RepositoryStatus.ERROR_NETWORK) == query.getStatus().getCode()
+ && query.getStatus().getMessage().equals("Http error: Internal Server Error"))); //$NON-NLS-1$
if (showError) {
image = CommonImages.OVERLAY_SYNC_ERROR;
} else {

Back to the top