Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2011-03-02 04:49:27 +0000
committerspingel2011-03-02 04:49:27 +0000
commitcf686fe370cc3d1cbc5eb7c92ae0f5c911a0eb05 (patch)
treef009ed3bb0267f371048242ea84c84616d7da48e /org.eclipse.mylyn.tasks.ui
parent19dc496b0a5c26824fee5a32b599b0c95e0bf52e (diff)
downloadorg.eclipse.mylyn.tasks-cf686fe370cc3d1cbc5eb7c92ae0f5c911a0eb05.tar.gz
org.eclipse.mylyn.tasks-cf686fe370cc3d1cbc5eb7c92ae0f5c911a0eb05.tar.xz
org.eclipse.mylyn.tasks-cf686fe370cc3d1cbc5eb7c92ae0f5c911a0eb05.zip
NEW - bug 286963: [api] add support for ignoring incoming notification on specified fields
https://bugs.eclipse.org/bugs/show_bug.cgi?id=286963
Diffstat (limited to 'org.eclipse.mylyn.tasks.ui')
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java14
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskListNotifier.java16
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListToolTip.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskScheduleContentProvider.java16
4 files changed, 35 insertions, 15 deletions
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 cc33433aa..4ca0e2b10 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
@@ -390,6 +390,8 @@ public class TasksUiPlugin extends AbstractUIPlugin {
private final AtomicInteger initializationCount = new AtomicInteger();
+ private SynchronizationManger synchronizationManger;
+
private class TasksUiInitializationJob extends UIJob {
public TasksUiInitializationJob() {
@@ -604,7 +606,7 @@ public class TasksUiPlugin extends AbstractUIPlugin {
// instantiate taskDataManager
TaskDataStore taskDataStore = new TaskDataStore(repositoryManager);
- SynchronizationManger synchronizationManger = new SynchronizationManger(repositoryModel);
+ synchronizationManger = new SynchronizationManger(repositoryModel);
taskDataManager = new TaskDataManager(taskDataStore, repositoryManager, taskList, taskActivityManager,
synchronizationManger);
@@ -1359,8 +1361,10 @@ public class TasksUiPlugin extends AbstractUIPlugin {
try {
taskListNotificationManager.addNotificationProvider(REMINDER_NOTIFICATION_PROVIDER);
// taskListNotificationManager.addNotificationProvider(INCOMING_NOTIFICATION_PROVIDER);
- taskListNotificationManager.addNotificationProvider(new TaskListNotifier(getRepositoryModel(),
- getTaskDataManager()));
+ TaskListNotifier taskListNotifier = new TaskListNotifier(getRepositoryModel(), getTaskDataManager(),
+ getSynchronizationManger());
+ getTaskDataManager().addListener(taskListNotifier);
+ taskListNotificationManager.addNotificationProvider(taskListNotifier);
taskListNotificationManager.startNotification(NOTIFICATION_DELAY);
getPreferenceStore().addPropertyChangeListener(taskListNotificationManager);
} catch (Throwable t) {
@@ -1385,4 +1389,8 @@ public class TasksUiPlugin extends AbstractUIPlugin {
return serviceMessageManager;
}
+ public SynchronizationManger getSynchronizationManger() {
+ return synchronizationManger;
+ }
+
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskListNotifier.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskListNotifier.java
index c26e246ad..5ab2e2601 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskListNotifier.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskListNotifier.java
@@ -19,11 +19,13 @@ import java.util.Set;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.internal.provisional.commons.ui.AbstractNotification;
import org.eclipse.mylyn.internal.tasks.core.RepositoryModel;
import org.eclipse.mylyn.internal.tasks.core.data.ITaskDataManagerListener;
+import org.eclipse.mylyn.internal.tasks.core.data.SynchronizationManger;
import org.eclipse.mylyn.internal.tasks.core.data.TaskDataDiff;
import org.eclipse.mylyn.internal.tasks.core.data.TaskDataManager;
import org.eclipse.mylyn.internal.tasks.core.data.TaskDataManagerEvent;
@@ -48,10 +50,13 @@ public class TaskListNotifier implements ITaskDataManagerListener, ITaskListNoti
public boolean enabled;
- public TaskListNotifier(RepositoryModel repositoryModel, TaskDataManager taskDataManager) {
+ private final SynchronizationManger synchronizationManger;
+
+ public TaskListNotifier(RepositoryModel repositoryModel, TaskDataManager taskDataManager,
+ SynchronizationManger synchronizationManger) {
this.repositoryModel = repositoryModel;
this.taskDataManager = taskDataManager;
- this.taskDataManager.addListener(this);
+ this.synchronizationManger = synchronizationManger;
}
public TaskListNotification getNotification(ITask task, Object token) {
@@ -61,7 +66,7 @@ public class TaskListNotifier implements ITaskDataManagerListener, ITaskListNoti
return notification;
} else if (task.getSynchronizationState() == SynchronizationState.INCOMING) {
TaskDataDiff diff = getDiff(task);
- if (diff != null) {
+ if (diff != null && diff.hasChanged()) {
TaskListNotification notification = new TaskListNotification(task, token);
notification.setDescription(TaskDiffUtil.toString(diff, 60, true));
return notification;
@@ -75,9 +80,8 @@ public class TaskListNotifier implements ITaskDataManagerListener, ITaskListNoti
try {
workingCopy = taskDataManager.getTaskDataState(task);
if (workingCopy != null) {
- TaskDataDiff diff = new TaskDataDiff(repositoryModel, workingCopy.getRepositoryData(),
- workingCopy.getLastReadData());
- return diff;
+ return synchronizationManger.createDiff(workingCopy.getRepositoryData(), workingCopy.getLastReadData(),
+ new NullProgressMonitor());
}
} catch (CoreException e) {
StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Failed to get task data for task: \"" //$NON-NLS-1$
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListToolTip.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListToolTip.java
index cd2bc9623..4300edfd3 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListToolTip.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListToolTip.java
@@ -297,9 +297,9 @@ public class TaskListToolTip extends GradientToolTip {
if (task.getSynchronizationState().isIncoming()) {
String text = null;
TaskListNotifier notifier = new TaskListNotifier(TasksUiPlugin.getRepositoryModel(),
- TasksUiPlugin.getTaskDataManager());
+ TasksUiPlugin.getTaskDataManager(), TasksUiPlugin.getDefault().getSynchronizationManger());
TaskDataDiff diff = notifier.getDiff(task);
- if (diff != null) {
+ if (diff != null && diff.hasChanged()) {
text = TaskDiffUtil.toString(diff, MAX_TEXT_WIDTH, false);
}
if (text != null && text.length() > 0) {
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 b1ad83c10..aff9f644e 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
@@ -25,6 +25,7 @@ import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
import org.eclipse.mylyn.internal.tasks.core.DateRange;
+import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
import org.eclipse.mylyn.internal.tasks.core.ScheduledTaskContainer;
import org.eclipse.mylyn.internal.tasks.core.TaskActivityManager;
import org.eclipse.mylyn.internal.tasks.core.TaskActivityUtil;
@@ -221,6 +222,12 @@ public class TaskScheduleContentProvider extends TaskListContentProvider impleme
// ignore
}
+ private static boolean notScheduled(ITask task) {
+ SynchronizationState state = task.getSynchronizationState();
+ return state == SynchronizationState.SYNCHRONIZED
+ || (state == SynchronizationState.INCOMING && Boolean.parseBoolean(task.getAttribute(ITasksCoreConstants.ATTRIBUTE_TASK_SUPPRESS_INCOMING)));
+ }
+
public class Unscheduled extends StateTaskContainer {
public Unscheduled() {
@@ -229,7 +236,7 @@ public class TaskScheduleContentProvider extends TaskListContentProvider impleme
@Override
protected boolean select(ITask task) {
- return task.getSynchronizationState() == SynchronizationState.SYNCHRONIZED && !task.isCompleted();
+ return !task.isCompleted() && notScheduled(task);
}
}
@@ -309,9 +316,9 @@ public class TaskScheduleContentProvider extends TaskListContentProvider impleme
@Override
protected boolean select(ITask task) {
SynchronizationState state = task.getSynchronizationState();
- return state == SynchronizationState.INCOMING || state == SynchronizationState.INCOMING_NEW;
+ return state == SynchronizationState.INCOMING_NEW
+ || (state == SynchronizationState.INCOMING && !Boolean.parseBoolean(task.getAttribute(ITasksCoreConstants.ATTRIBUTE_TASK_SUPPRESS_INCOMING)));
}
-
}
public class Outgoing extends StateTaskContainer {
@@ -336,8 +343,9 @@ public class TaskScheduleContentProvider extends TaskListContentProvider impleme
@Override
public boolean select(ITask task) {
- return (task.isCompleted() && task.getSynchronizationState().equals(SynchronizationState.SYNCHRONIZED));
+ return task.isCompleted() && notScheduled(task);
}
+
}
private class RolloverCheck extends Job {

Back to the top