Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrandon Dong2016-01-19 20:23:20 -0500
committerBrandon Dong2016-02-01 20:01:11 -0500
commit8902a34bff4c8a8ccf6b80ff2401f05447d8e2e6 (patch)
treefdf8f433b92ac5ddd0c4c26a576f37a2dec0a2c5 /org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal
parent86a71b8f9f3d06363e499a6550f072acbf3ff57b (diff)
downloadorg.eclipse.mylyn.tasks-8902a34bff4c8a8ccf6b80ff2401f05447d8e2e6.tar.gz
org.eclipse.mylyn.tasks-8902a34bff4c8a8ccf6b80ff2401f05447d8e2e6.tar.xz
org.eclipse.mylyn.tasks-8902a34bff4c8a8ccf6b80ff2401f05447d8e2e6.zip
486145: tasks should not receive incoming notifications for attributes
that aren't visible Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=486145 Change-Id: I57980475082de716c2ca24a11e0bc4b31121cdc5 Signed-off-by: Brandon Dong <brandon.dong@tasktop.com>
Diffstat (limited to 'org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal')
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/SynchronizationManger.java24
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/TaskDataDiff.java17
2 files changed, 20 insertions, 21 deletions
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/SynchronizationManger.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/SynchronizationManger.java
index cbdfd1592..f3d6be684 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/SynchronizationManger.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/SynchronizationManger.java
@@ -68,7 +68,6 @@ public class SynchronizationManger {
it.remove();
}
}
- diff.setHasChanged(diff.getChangedAttributes().size() > 0 || diff.getNewComments().size() > 0);
}
}
@@ -93,8 +92,8 @@ public class SynchronizationManger {
List<String> attributeIds = new ArrayList<String>();
IExtensionRegistry registry = Platform.getExtensionRegistry();
- IExtensionPoint connectorsExtensionPoint = registry.getExtensionPoint(ITasksCoreConstants.ID_PLUGIN
- + ".synchronizationParticipants"); //$NON-NLS-1$
+ IExtensionPoint connectorsExtensionPoint = registry
+ .getExtensionPoint(ITasksCoreConstants.ID_PLUGIN + ".synchronizationParticipants"); //$NON-NLS-1$
IExtension[] extensions = connectorsExtensionPoint.getExtensions();
for (IExtension extension : extensions) {
IConfigurationElement[] elements = extension.getConfigurationElements();
@@ -109,20 +108,15 @@ public class SynchronizationManger {
participant.setId(element.getAttribute("id")); //$NON-NLS-1$
participants.add(participant);
} else {
- status.add(new Status(
- IStatus.ERROR,
- ITasksCoreConstants.ID_PLUGIN,
- NLS.bind(
- "Connector core ''{0}'' does not extend expected class for extension contributed by {1}", //$NON-NLS-1$
- object.getClass().getCanonicalName(), element.getContributor()
- .getName())));
+ status.add(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, NLS.bind(
+ "Connector core ''{0}'' does not extend expected class for extension contributed by {1}", //$NON-NLS-1$
+ object.getClass().getCanonicalName(), element.getContributor().getName())));
}
} catch (Throwable e) {
- status.add(new Status(
- IStatus.ERROR,
- ITasksCoreConstants.ID_PLUGIN,
- NLS.bind(
- "Connector core failed to load for extension contributed by {0}", element.getContributor().getName()), e)); //$NON-NLS-1$
+ status.add(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN,
+ NLS.bind("Connector core failed to load for extension contributed by {0}", //$NON-NLS-1$
+ element.getContributor().getName()),
+ e));
}
}
} else if ("suppressIncoming".equals(element.getName())) { //$NON-NLS-1$
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/TaskDataDiff.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/TaskDataDiff.java
index 74fefffa4..83fb7c4b6 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/TaskDataDiff.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/TaskDataDiff.java
@@ -38,12 +38,12 @@ public class TaskDataDiff implements ITaskDataDiff {
private final Set<ITaskComment> newComments = new LinkedHashSet<ITaskComment>();
+ private final Set<TaskAttribute> newAttachments = new LinkedHashSet<TaskAttribute>();
+
private final Set<ITaskAttributeDiff> changedAttributes = new LinkedHashSet<ITaskAttributeDiff>();
private final RepositoryModel repositoryModel;
- public boolean hasChanged;
-
private final TaskRepository repository;
public TaskDataDiff(RepositoryModel repositoryModel, TaskData newTaskData, TaskData oldTaskData) {
@@ -53,16 +53,16 @@ public class TaskDataDiff implements ITaskDataDiff {
this.repository = newTaskData.getAttributeMapper().getTaskRepository();
this.newTaskData = newTaskData;
this.oldTaskData = oldTaskData;
- this.hasChanged = true;
parse();
}
public boolean hasChanged() {
- return hasChanged;
+ return !changedAttributes.isEmpty() || !newComments.isEmpty() || !newAttachments.isEmpty();
}
+ @Deprecated
public void setHasChanged(boolean hasChanged) {
- this.hasChanged = hasChanged;
+
}
public TaskRepository getRepository() {
@@ -81,6 +81,10 @@ public class TaskDataDiff implements ITaskDataDiff {
return newComments;
}
+ public Collection<TaskAttribute> getNewAttachments() {
+ return newAttachments;
+ }
+
public Collection<ITaskAttributeDiff> getChangedAttributes() {
return changedAttributes;
}
@@ -127,6 +131,8 @@ public class TaskDataDiff implements ITaskDataDiff {
String type = attribute.getMetaData().getType();
if (TaskAttribute.TYPE_COMMENT.equals(type)) {
addChangedComment(oldAttribute, newAttribute);
+ } else if (TaskAttribute.TYPE_ATTACHMENT.equals(type)) {
+ newAttachments.add(attribute);
} else if (TaskAttribute.TYPE_OPERATION.equals(type)) {
// ignore
} else if (ignoreKind || attribute.getMetaData().getKind() != null) {
@@ -145,5 +151,4 @@ public class TaskDataDiff implements ITaskDataDiff {
}
}
}
-
}

Back to the top