Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaxsun McCarthy Huggan2016-10-18 17:11:32 -0400
committerGerrit Code Review @ Eclipse.org2016-10-20 14:45:37 -0400
commit6acaf16af156b3fea92e8e0c4523ae6e3e1cc3ef (patch)
tree920f2b89414517091af8c290d2b1cd7883a9382d
parenteb3862868d2d721211a1cb89d798c8e741b6b9d3 (diff)
downloadorg.eclipse.mylyn.tasks-6acaf16af156b3fea92e8e0c4523ae6e3e1cc3ef.tar.gz
org.eclipse.mylyn.tasks-6acaf16af156b3fea92e8e0c4523ae6e3e1cc3ef.tar.xz
org.eclipse.mylyn.tasks-6acaf16af156b3fea92e8e0c4523ae6e3e1cc3ef.zip
502035: Revise preferences for automatic task list synchronization
* refactor TasksUiPlugin to separate task list synchronization * added preference to toggle the relevant task synchronization * relevant task sync will occur when background sync and relevant task sync are both enabled * added a help tooltip to explain how relevant tasks are determined Change-Id: Id0d9d177c394cd1074e47e14c3825da11eceb3e9 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=502035
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ITasksUiPreferenceConstants.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListScheduledSynchronizationManager.java111
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java88
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/preferences/Messages.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/preferences/TasksUiPreferencePage.java73
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/preferences/messages.properties3
6 files changed, 184 insertions, 97 deletions
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 8ae089cff..15d1956be 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
@@ -86,6 +86,8 @@ public interface ITasksUiPreferenceConstants {
public static final String REPOSITORY_SYNCH_SCHEDULE_MILISECONDS = "org.eclipse.mylyn.tasks.ui.repositories.synch.schedule.miliseconds"; //$NON-NLS-1$
+ public static final String RELEVANT_SYNCH_SCHEDULE_ENABLED = "org.eclipse.mylyn.tasks.ui.relevant.tasks.synch.schedule"; //$NON-NLS-1$
+
public static final String RELEVANT_TASKS_SCHEDULE_MILISECONDS = "org.eclipse.mylyn.tasks.ui.relevant.tasks.synch.schedule.miliseconds"; //$NON-NLS-1$
public static final String TEMPLATES_DELETED = "org.eclipse.mylyn.tasks.ui.templates.deleted"; //$NON-NLS-1$
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListScheduledSynchronizationManager.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListScheduledSynchronizationManager.java
new file mode 100644
index 000000000..48771fe36
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListScheduledSynchronizationManager.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.tasks.ui;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.mylyn.internal.monitor.ui.MonitorUiPlugin;
+import org.eclipse.mylyn.internal.tasks.core.ITaskJobFactory;
+import org.eclipse.mylyn.internal.tasks.core.TaskActivityManager;
+import org.eclipse.mylyn.tasks.core.IRepositoryManager;
+import org.eclipse.mylyn.tasks.core.sync.SynchronizationJob;
+
+import com.google.common.collect.ImmutableList;
+
+class TaskListScheduledSynchronizationManager {
+
+ private static final int DELAY_QUERY_REFRESH_ON_STARTUP = 20 * 1000;
+
+ private static final List<String> FULL_REFRESH_ENABLEMENT_KEYS = ImmutableList
+ .of(ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED);
+
+ private static final List<String> RELEVANT_TASKS_REFRESH_ENABLEMENT_KEYS = ImmutableList.of(
+ ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED,
+ ITasksUiPreferenceConstants.RELEVANT_SYNCH_SCHEDULE_ENABLED);
+
+ private final TaskListSynchronizationScheduler fullRefreshScheduler;
+
+ private final TaskListSynchronizationScheduler relevantTaskScheduler;
+
+ public TaskListScheduledSynchronizationManager(ITaskJobFactory taskJobFactory,
+ TaskActivityManager taskActivityManager, IRepositoryManager repositoryManager) {
+ SynchronizationJob refreshJob = taskJobFactory.createSynchronizeRepositoriesJob(null);
+ refreshJob.setFullSynchronization(true);
+
+ fullRefreshScheduler = new TaskListSynchronizationScheduler(refreshJob);
+ updateSynchronizationScheduler(fullRefreshScheduler, true,
+ ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_MILISECONDS, FULL_REFRESH_ENABLEMENT_KEYS);
+
+ Job relevantJob = new SynchronizeRelevantTasksJob(taskActivityManager, repositoryManager, taskJobFactory);
+ relevantTaskScheduler = new TaskListSynchronizationScheduler(relevantJob);
+ updateSynchronizationScheduler(relevantTaskScheduler, true,
+ ITasksUiPreferenceConstants.RELEVANT_TASKS_SCHEDULE_MILISECONDS,
+ RELEVANT_TASKS_REFRESH_ENABLEMENT_KEYS);
+
+ MonitorUiPlugin.getDefault().getActivityContextManager().addListener(fullRefreshScheduler);
+ MonitorUiPlugin.getDefault().getActivityContextManager().addListener(relevantTaskScheduler);
+ }
+
+ public void processPreferenceChange(PropertyChangeEvent event) {
+ if (event.getProperty().equals(ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_MILISECONDS)
+ || event.getProperty().equals(ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED)) {
+ updateSynchronizationScheduler(fullRefreshScheduler, false,
+ ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_MILISECONDS, FULL_REFRESH_ENABLEMENT_KEYS);
+ }
+
+ if (event.getProperty().equals(ITasksUiPreferenceConstants.RELEVANT_TASKS_SCHEDULE_MILISECONDS)
+ || event.getProperty().equals(ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED)
+ || event.getProperty().equals(ITasksUiPreferenceConstants.RELEVANT_SYNCH_SCHEDULE_ENABLED)) {
+ updateSynchronizationScheduler(relevantTaskScheduler, false,
+ ITasksUiPreferenceConstants.RELEVANT_TASKS_SCHEDULE_MILISECONDS,
+ RELEVANT_TASKS_REFRESH_ENABLEMENT_KEYS);
+ }
+ }
+
+ /**
+ * Updates the scheduler with the latest user-set preferences.
+ *
+ * @param scheduler
+ * The scheduler to schedule refreshes.
+ * @param isInitialInvocation
+ * {@code true} for the initial invocation; {@code false} for later invocations. When {@code true}, the
+ * scheduler interval is set to a fixed startup delay (typically 20 seconds).
+ * @param intervalKey
+ * The key in the preferences which is used to retrieve the latest schedule interval time.
+ * @param enabledKeys
+ * The keys of the preferences which must all be true to enable the given scheduler
+ */
+ private void updateSynchronizationScheduler(TaskListSynchronizationScheduler scheduler, boolean isInitialInvocation,
+ String intervalKey, List<String> enabledKeys) {
+ if (scheduler == null) {
+ return;
+ }
+
+ boolean enabled = true;
+ for (String enabledKey : enabledKeys) {
+ enabled &= TasksUiPlugin.getDefault().getPreferenceStore().getBoolean(enabledKey);
+ }
+
+ if (enabled) {
+ long interval = TasksUiPlugin.getDefault().getPreferenceStore().getLong(intervalKey);
+ if (isInitialInvocation) {
+ scheduler.setInterval(DELAY_QUERY_REFRESH_ON_STARTUP, interval);
+ } else {
+ scheduler.setInterval(interval);
+ }
+ } else {
+ scheduler.setInterval(0);
+ }
+ }
+}
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 7d010ffa3..84e7d14db 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
@@ -107,7 +107,6 @@ import org.eclipse.mylyn.tasks.core.RepositoryTemplate;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.core.activity.AbstractTaskActivityMonitor;
import org.eclipse.mylyn.tasks.core.context.AbstractTaskContextStore;
-import org.eclipse.mylyn.tasks.core.sync.SynchronizationJob;
import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
import org.eclipse.mylyn.tasks.ui.AbstractTaskRepositoryLinkProvider;
import org.eclipse.mylyn.tasks.ui.TasksUi;
@@ -135,8 +134,6 @@ import org.osgi.util.tracker.ServiceTracker;
*/
public class TasksUiPlugin extends AbstractUIPlugin {
- private static final int DELAY_QUERY_REFRESH_ON_STARTUP = 20 * 1000;
-
private static final int DEFAULT_LINK_PROVIDER_TIMEOUT = 5 * 1000;
public static final String ID_PLUGIN = "org.eclipse.mylyn.tasks.ui"; //$NON-NLS-1$
@@ -155,6 +152,9 @@ public class TasksUiPlugin extends AbstractUIPlugin {
private static final String PROP_FORCE_CREDENTIALS_MIGRATION = "org.eclipse.mylyn.tasks.force.credentials.migration"; //$NON-NLS-1$
+ private static final boolean DEBUG_HTTPCLIENT = "true" //$NON-NLS-1$
+ .equalsIgnoreCase(Platform.getDebugOption("org.eclipse.mylyn.tasks.ui/debug/httpclient")); //$NON-NLS-1$
+
private static TasksUiPlugin INSTANCE;
private static ExternalizationManager externalizationManager;
@@ -163,14 +163,12 @@ public class TasksUiPlugin extends AbstractUIPlugin {
private static TaskRepositoryManager repositoryManager;
- private static TaskListSynchronizationScheduler taskScheduler;
-
- private static TaskListSynchronizationScheduler relevantTaskScheduler;
-
private static TaskDataManager taskDataManager;
private static Map<String, AbstractRepositoryConnectorUi> repositoryConnectorUiMap = new HashMap<String, AbstractRepositoryConnectorUi>();
+ private static AbstractTaskContextStore contextStore;
+
private TaskListNotificationManager taskListNotificationManager;
private TaskListBackupManager taskListBackupManager;
@@ -197,13 +195,8 @@ public class TasksUiPlugin extends AbstractUIPlugin {
// shared colors for all forms
private FormColors formColors;
- private static AbstractTaskContextStore contextStore;
-
private final List<AbstractSearchHandler> searchHandlers = new ArrayList<AbstractSearchHandler>();
- 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 {
@@ -292,20 +285,6 @@ public class TasksUiPlugin extends AbstractUIPlugin {
updateTaskActivityManager();
}
- if (event.getProperty().equals(ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED)
- || event.getProperty().equals(ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_MILISECONDS)) {
- updateSynchronizationScheduler(taskScheduler, false,
- ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED,
- ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_MILISECONDS);
- }
-
- if (event.getProperty().equals(ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED)
- || event.getProperty().equals(ITasksUiPreferenceConstants.RELEVANT_TASKS_SCHEDULE_MILISECONDS)) {
- updateSynchronizationScheduler(relevantTaskScheduler, false,
- ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED,
- ITasksUiPreferenceConstants.RELEVANT_TASKS_SCHEDULE_MILISECONDS);
- }
-
if (event.getProperty().equals(ITasksUiPreferenceConstants.SERVICE_MESSAGES_ENABLED)) {
if (getPreferenceStore().getBoolean(ITasksUiPreferenceConstants.SERVICE_MESSAGES_ENABLED)) {
serviceMessageManager.start();
@@ -313,6 +292,8 @@ public class TasksUiPlugin extends AbstractUIPlugin {
serviceMessageManager.stop();
}
}
+
+ synchronizationManager.processPreferenceChange(event);
}
};
@@ -344,6 +325,8 @@ public class TasksUiPlugin extends AbstractUIPlugin {
private RepositoryConnectorLoader connectorLoader;
+ private TaskListScheduledSynchronizationManager synchronizationManager;
+
private class TasksUiInitializationJob extends UIJob {
public TasksUiInitializationJob() {
@@ -492,38 +475,6 @@ public class TasksUiPlugin extends AbstractUIPlugin {
}
}
- /**
- * Updates the scheduler with the latest user-set preferences.
- *
- * @param scheduler
- * The scheduler to schedule refreshes.
- * @param initial
- * <b>true</b> for the initial invocation; <b>false</b> for later invocations. When <b>true</b>, the
- * scheduler interval is set to a fixed startup delay (typically 20 seconds).
- * @param enabledKey
- * The string key in the preferences which is used to retrieve the latest user-set value (on/off).
- * @param intervalKey
- * The string key in the preferences which is used to retrieve the latest schedule interval time.
- */
- private void updateSynchronizationScheduler(TaskListSynchronizationScheduler scheduler, boolean initial,
- String enabledKey, String intervalKey) {
- if (scheduler == null) {
- return;
- }
-
- boolean enabled = TasksUiPlugin.getDefault().getPreferenceStore().getBoolean(enabledKey);
- if (enabled) {
- long interval = TasksUiPlugin.getDefault().getPreferenceStore().getLong(intervalKey);
- if (initial) {
- scheduler.setInterval(DELAY_QUERY_REFRESH_ON_STARTUP, interval);
- } else {
- scheduler.setInterval(interval);
- }
- } else {
- scheduler.setInterval(0);
- }
- }
-
@SuppressWarnings("restriction")
@Override
public void start(BundleContext context) throws Exception {
@@ -1016,6 +967,7 @@ public class TasksUiPlugin extends AbstractUIPlugin {
store.setDefault(ITasksUiPreferenceConstants.USE_STRIKETHROUGH_FOR_COMPLETED, true);
store.setDefault(ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED, true);
+ store.setDefault(ITasksUiPreferenceConstants.RELEVANT_SYNCH_SCHEDULE_ENABLED, true);
store.setDefault(ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_MILISECONDS, "" + (20 * 60 * 1000)); //$NON-NLS-1$
store.setDefault(ITasksUiPreferenceConstants.RELEVANT_TASKS_SCHEDULE_MILISECONDS, "" + (5 * 60 * 1000)); //$NON-NLS-1$
@@ -1280,6 +1232,7 @@ public class TasksUiPlugin extends AbstractUIPlugin {
// find a provider that can set new repository
for (final AbstractTaskRepositoryLinkProvider linkProvider : repositoryLinkProviders) {
SafeRunner.run(new ISafeRunnable() {
+
public void handleException(Throwable e) {
StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
"Task repository link provider failed: \"" + linkProvider.getId() + "\"", e)); //$NON-NLS-1$ //$NON-NLS-2$
@@ -1290,6 +1243,7 @@ public class TasksUiPlugin extends AbstractUIPlugin {
result[0] = true;
}
}
+
});
if (result[0]) {
return true;
@@ -1465,22 +1419,8 @@ public class TasksUiPlugin extends AbstractUIPlugin {
// trigger backup scheduler
getBackupManager();
- SynchronizationJob refreshJob = taskJobFactory.createSynchronizeRepositoriesJob(null);
- refreshJob.setFullSynchronization(true);
-
- taskScheduler = new TaskListSynchronizationScheduler(refreshJob);
- MonitorUiPlugin.getDefault().getActivityContextManager().addListener(taskScheduler);
- updateSynchronizationScheduler(taskScheduler, true,
- ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED,
- ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_MILISECONDS);
-
- Job relevantJob = new SynchronizeRelevantTasksJob(taskActivityManager, repositoryManager, taskJobFactory);
- relevantTaskScheduler = new TaskListSynchronizationScheduler(relevantJob);
- MonitorUiPlugin.getDefault().getActivityContextManager().addListener(relevantTaskScheduler);
- updateSynchronizationScheduler(relevantTaskScheduler, true,
- ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED,
- ITasksUiPreferenceConstants.RELEVANT_TASKS_SCHEDULE_MILISECONDS);
-
+ synchronizationManager = new TaskListScheduledSynchronizationManager(taskJobFactory, taskActivityManager,
+ repositoryManager);
} catch (Throwable t) {
StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
"Could not initialize task list backup and synchronization", t)); //$NON-NLS-1$
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 7864200b3..d55e25313 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
@@ -67,6 +67,8 @@ public class Messages extends NLS {
public static String TasksUiPreferencePage_highlight_current_line;
+ public static String TasksUiPreferencePage_RelevantTasksHelp;
+
public static String TasksUiPreferencePage_Rich_Editor__Recommended_;
public static String TasksUiPreferencePage_ScheduleNewTasks;
@@ -83,7 +85,7 @@ public class Messages extends NLS {
public static String TasksUiPreferencePage_Stop_time_accumulation_after;
- public static String TasksUiPreferencePage_Synchronize_Fully;
+ public static String TasksUiPreferencePage_Synchronize_Queries;
public static String TasksUiPreferencePage_Synchronize_Relevant_Tasks;
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 a013bc281..4322adbee 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
@@ -23,6 +23,7 @@ import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.mylyn.commons.core.CommonMessages;
import org.eclipse.mylyn.commons.core.StatusHandler;
+import org.eclipse.mylyn.commons.ui.CommonImages;
import org.eclipse.mylyn.commons.ui.compatibility.CommonColors;
import org.eclipse.mylyn.internal.monitor.ui.ActivityContextManager;
import org.eclipse.mylyn.internal.monitor.ui.MonitorUiPlugin;
@@ -92,17 +93,19 @@ public class TasksUiPreferencePage extends PreferencePage implements IWorkbenchP
private Button useWebBrowser;
- private Text fullSyncScheduleTime = null;
+ private Text fullSyncScheduleTime;
- private Text relevantTasksSyncScheduleTime = null;
+ private Text relevantTasksSyncScheduleTime;
- private Button enableBackgroundSynch;
+ private Button enableFullTaskListSynch;
- private Text taskDirectoryText = null;
+ private Button enableRelevantTasksSynch;
- private Button browse = null;
+ private Text taskDirectoryText;
- private Button notificationEnabledButton = null;
+ private Button browse;
+
+ private Button notificationEnabledButton;
private final FormToolkit toolkit;
@@ -226,7 +229,9 @@ public class TasksUiPreferencePage extends PreferencePage implements IWorkbenchP
editorHighlightsCurrentLine.getSelection());
getPreferenceStore().setValue(ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED,
- enableBackgroundSynch.getSelection());
+ enableFullTaskListSynch.getSelection());
+ getPreferenceStore().setValue(ITasksUiPreferenceConstants.RELEVANT_SYNCH_SCHEDULE_ENABLED,
+ enableRelevantTasksSynch.getSelection());
String miliseconds = toMillisecondsString(fullSyncScheduleTime.getText());
getPreferenceStore().setValue(ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_MILISECONDS, miliseconds);
@@ -309,9 +314,13 @@ public class TasksUiPreferencePage extends PreferencePage implements IWorkbenchP
getPreferenceStore().getLong(ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_MILISECONDS));
String relevantSyncMinutes = toMinutesString(
getPreferenceStore().getLong(ITasksUiPreferenceConstants.RELEVANT_TASKS_SCHEDULE_MILISECONDS));
- boolean shouldSyncAutomatically = getPreferenceStore()
+ boolean shouldSyncTaskList = getPreferenceStore()
.getBoolean(ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED);
- enableBackgroundSynch.setSelection(shouldSyncAutomatically);
+ boolean shouldSyncRelevantTasks = getPreferenceStore()
+ .getBoolean(ITasksUiPreferenceConstants.RELEVANT_SYNCH_SCHEDULE_ENABLED);
+
+ enableFullTaskListSynch.setSelection(shouldSyncTaskList);
+ enableRelevantTasksSynch.setSelection(shouldSyncRelevantTasks);
fullSyncScheduleTime.setText(repositorySyncMinutes);
relevantTasksSyncScheduleTime.setText(relevantSyncMinutes);
@@ -358,8 +367,10 @@ public class TasksUiPreferencePage extends PreferencePage implements IWorkbenchP
getPreferenceStore().getDefaultBoolean(ITasksUiPreferenceConstants.SERVICE_MESSAGES_ENABLED));
showTaskTrimButton.setSelection(getPreferenceStore().getDefaultBoolean(ITasksUiPreferenceConstants.SHOW_TRIM));
- enableBackgroundSynch.setSelection(
+ enableFullTaskListSynch.setSelection(
getPreferenceStore().getDefaultBoolean(ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED));
+ enableRelevantTasksSynch.setSelection(
+ getPreferenceStore().getDefaultBoolean(ITasksUiPreferenceConstants.RELEVANT_SYNCH_SCHEDULE_ENABLED));
fullSyncScheduleTime.setText(toMinutesString(getPreferenceStore()
.getDefaultLong(ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_MILISECONDS)));
relevantTasksSyncScheduleTime.setText(toMinutesString(
@@ -393,14 +404,14 @@ public class TasksUiPreferencePage extends PreferencePage implements IWorkbenchP
group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Composite backgroundSync = new Composite(group, SWT.NULL);
- GridLayoutFactory.swtDefaults().numColumns(3).equalWidth(false).margins(0, 0).applyTo(backgroundSync);
+ GridLayoutFactory.swtDefaults().numColumns(4).equalWidth(false).margins(0, 0).applyTo(backgroundSync);
//Enabled background synchronization
- enableBackgroundSynch = new Button(backgroundSync, SWT.CHECK);
- enableBackgroundSynch.setText(Messages.TasksUiPreferencePage_Synchronize_Task_List);
- enableBackgroundSynch.setSelection(
+ enableFullTaskListSynch = new Button(backgroundSync, SWT.CHECK);
+ enableFullTaskListSynch.setText(Messages.TasksUiPreferencePage_Synchronize_Task_List);
+ enableFullTaskListSynch.setSelection(
getPreferenceStore().getBoolean(ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED));
- enableBackgroundSynch.addSelectionListener(new SelectionListener() {
+ enableFullTaskListSynch.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
updateRefreshGroupEnablements();
}
@@ -408,19 +419,35 @@ public class TasksUiPreferencePage extends PreferencePage implements IWorkbenchP
public void widgetDefaultSelected(SelectionEvent e) {
}
});
- GridDataFactory.defaultsFor(enableBackgroundSynch).span(3, 1).applyTo(enableBackgroundSynch);
+ GridDataFactory.defaultsFor(enableFullTaskListSynch).span(4, 1).applyTo(enableFullTaskListSynch);
//Synchronize Task List Fully
- new Label(backgroundSync, SWT.NONE).setText(Messages.TasksUiPreferencePage_Synchronize_Fully);
+ new Label(backgroundSync, SWT.NONE).setText(Messages.TasksUiPreferencePage_Synchronize_Queries);
fullSyncScheduleTime = createSynchronizationScheduleTextBox(backgroundSync,
ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_MILISECONDS);
new Label(backgroundSync, SWT.NONE).setText(Messages.TasksUiPreferencePage_minutes);
+ new Label(backgroundSync, SWT.NONE);
//Synchronize Relevant Tasks
- new Label(backgroundSync, SWT.NONE).setText(Messages.TasksUiPreferencePage_Synchronize_Relevant_Tasks);
+ enableRelevantTasksSynch = new Button(backgroundSync, SWT.CHECK);
+ enableRelevantTasksSynch.setText(Messages.TasksUiPreferencePage_Synchronize_Relevant_Tasks);
+ enableRelevantTasksSynch.setSelection(
+ getPreferenceStore().getBoolean(ITasksUiPreferenceConstants.RELEVANT_SYNCH_SCHEDULE_ENABLED));
+ enableRelevantTasksSynch.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ updateRefreshGroupEnablements();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+
relevantTasksSyncScheduleTime = createSynchronizationScheduleTextBox(backgroundSync,
ITasksUiPreferenceConstants.RELEVANT_TASKS_SCHEDULE_MILISECONDS);
new Label(backgroundSync, SWT.NONE).setText(Messages.TasksUiPreferencePage_minutes);
+ Label help = new Label(backgroundSync, SWT.NONE);
+ help.setImage(CommonImages.getImage(CommonImages.QUESTION));
+ help.setToolTipText(Messages.TasksUiPreferencePage_RelevantTasksHelp);
//notification
notificationEnabledButton = new Button(group, SWT.CHECK);
@@ -428,6 +455,7 @@ public class TasksUiPreferencePage extends PreferencePage implements IWorkbenchP
.setText(Messages.TasksUiPreferencePage_Display_notifications_for_overdue_tasks_and_incoming_changes);
notificationEnabledButton
.setSelection(getPreferenceStore().getBoolean(ITasksUiPreferenceConstants.NOTIFICATIONS_ENABLED));
+ GridDataFactory.defaultsFor(notificationEnabledButton).span(4, 1).applyTo(notificationEnabledButton);
}
@@ -639,7 +667,8 @@ public class TasksUiPreferencePage extends PreferencePage implements IWorkbenchP
public void updateRefreshGroupEnablements() {
String errorMessage = null;
- if (enableBackgroundSynch.getSelection()) {
+ boolean synchronizeTaskList = enableFullTaskListSynch.getSelection();
+ if (synchronizeTaskList) {
errorMessage = validateSynchronizeSchedule(fullSyncScheduleTime);
if (errorMessage == null) {
errorMessage = validateSynchronizeSchedule(relevantTasksSyncScheduleTime);
@@ -661,8 +690,10 @@ public class TasksUiPreferencePage extends PreferencePage implements IWorkbenchP
timeoutLabel2.setEnabled(false);
}
- fullSyncScheduleTime.setEnabled(enableBackgroundSynch.getSelection());
- relevantTasksSyncScheduleTime.setEnabled(enableBackgroundSynch.getSelection());
+ boolean synchronizeRelevantTasks = synchronizeTaskList && enableRelevantTasksSynch.getSelection();
+ enableRelevantTasksSynch.setEnabled(synchronizeTaskList);
+ fullSyncScheduleTime.setEnabled(synchronizeTaskList);
+ relevantTasksSyncScheduleTime.setEnabled(synchronizeRelevantTasks);
}
private String validateSynchronizeSchedule(Text synchronizeText) {
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 4180dfebe..09e48e424 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
@@ -29,6 +29,7 @@ TasksUiPreferencePage_minutes_of_inactivity=minutes of inactivity.
TasksUiPreferencePage_Notification_for_new_connectors_available_Label=Display notification when new connectors are available
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_RelevantTasksHelp=Relevant tasks are determined based on open Task editors, Task Scheduling, and Task activation.
TasksUiPreferencePage_Rich_Editor__Recommended_=Rich Editor (Recommended)
TasksUiPreferencePage_ScheduleNewTasks=Schedule New Tasks For:
TasksUiPreferencePage_Scheduling=Scheduling
@@ -37,7 +38,7 @@ TasksUiPreferencePage_Show_active_task_trim_Button_Label=Show active task on win
TasksUiPreferencePage_Show_tooltip_on_hover_Label=Show task overview popups on hover
TasksUiPreferencePage_Specify_the_folder_for_tasks=Specify the folder for tasks
TasksUiPreferencePage_Stop_time_accumulation_after=Stop time accumulation after
-TasksUiPreferencePage_Synchronize_Fully=Synchronize the Task List fully every
+TasksUiPreferencePage_Synchronize_Queries=Synchronize all Task List queries every
TasksUiPreferencePage_Synchronize_Relevant_Tasks=Synchronize relevant Tasks every
TasksUiPreferencePage_Synchronize_schedule_time_must_be_GT_0=Synchronize schedule time must be > 0
TasksUiPreferencePage_Synchronize_schedule_time_must_be_valid_integer=Synchronize schedule time must be valid integer

Back to the top