Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfbecker2010-07-06 14:38:52 -0400
committerfbecker2010-07-06 14:38:52 -0400
commit2772a56902d8c2846ba121b9dca65175c4106d1f (patch)
treed5f66a3857640addb45db23279ae34f4e7e7af03 /org.eclipse.mylyn.tasks.search
parent479a33239358219c723f7cc8fe68d2ac54a1bc04 (diff)
downloadorg.eclipse.mylyn.tasks-2772a56902d8c2846ba121b9dca65175c4106d1f.tar.gz
org.eclipse.mylyn.tasks-2772a56902d8c2846ba121b9dca65175c4106d1f.tar.xz
org.eclipse.mylyn.tasks-2772a56902d8c2846ba121b9dca65175c4106d1f.zip
ASSIGNED - bug 310076: [patch] Remove selected match does not work for Task Search
https://bugs.eclipse.org/bugs/show_bug.cgi?id=310076
Diffstat (limited to 'org.eclipse.mylyn.tasks.search')
-rw-r--r--org.eclipse.mylyn.tasks.search/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultTreeContentProvider.java81
1 files changed, 55 insertions, 26 deletions
diff --git a/org.eclipse.mylyn.tasks.search/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultTreeContentProvider.java b/org.eclipse.mylyn.tasks.search/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultTreeContentProvider.java
index 97d56fd09..9b09ef8bc 100644
--- a/org.eclipse.mylyn.tasks.search/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultTreeContentProvider.java
+++ b/org.eclipse.mylyn.tasks.search/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultTreeContentProvider.java
@@ -96,37 +96,66 @@ public class SearchResultTreeContentProvider extends SearchResultContentProvider
@Override
public void elementsChanged(Object[] updatedElements) {
for (Object object : updatedElements) {
- boolean added = elements.add(object);
- if (added && object instanceof ITask) {
- AbstractTask task = ((AbstractTask) object);
- String owner = task.getOwner();
- if (owner == null) {
- owner = Messages.SearchResultTreeContentProvider__unknown_;
+ boolean inResult = false;
+ Object[] resultElements = searchResult.getElements();
+ for (Object resultObject : resultElements) {
+ if (resultObject.equals(object)) {
+ inResult = true;
}
- Person person = owners.get(owner);
- if (person == null) {
- person = new Person(owner, task.getConnectorKind(), task.getRepositoryUrl());
- owners.put(owner, person);
+
+ }
+ if (inResult) {
+ boolean added = elements.add(object);
+ if (added && object instanceof ITask) {
+ AbstractTask task = ((AbstractTask) object);
+ String owner = task.getOwner();
+ if (owner == null) {
+ owner = Messages.SearchResultTreeContentProvider__unknown_;
+ }
+ Person person = owners.get(owner);
+ if (person == null) {
+ person = new Person(owner, task.getConnectorKind(), task.getRepositoryUrl());
+ owners.put(owner, person);
+ }
+ person.internalAddChild(task);
+
+ TaskGroup completeIncomplete = null;
+ if (task.isCompleted()) {
+ completeIncomplete = completeState.get(Messages.SearchResultTreeContentProvider_Complete);
+ if (completeIncomplete == null) {
+ completeIncomplete = new TaskGroup(
+ "group-complete", Messages.SearchResultTreeContentProvider_Complete, GroupBy.COMPLETION.name()); //$NON-NLS-1$
+ completeState.put(Messages.SearchResultTreeContentProvider_Complete, completeIncomplete);
+ }
+ } else {
+ completeIncomplete = completeState.get(Messages.SearchResultTreeContentProvider_Incomplete);
+ if (completeIncomplete == null) {
+ completeIncomplete = new TaskGroup(
+ "group-incomplete", Messages.SearchResultTreeContentProvider_Incomplete, GroupBy.COMPLETION.name()); //$NON-NLS-1$
+ completeState.put(Messages.SearchResultTreeContentProvider_Incomplete, completeIncomplete);
+ }
+ }
+ completeIncomplete.internalAddChild(task);
}
- person.internalAddChild(task);
-
- TaskGroup completeIncomplete = null;
- if (task.isCompleted()) {
- completeIncomplete = completeState.get(Messages.SearchResultTreeContentProvider_Complete);
- if (completeIncomplete == null) {
- completeIncomplete = new TaskGroup(
- "group-complete", Messages.SearchResultTreeContentProvider_Complete, GroupBy.COMPLETION.name()); //$NON-NLS-1$
- completeState.put(Messages.SearchResultTreeContentProvider_Complete, completeIncomplete);
+ } else {
+ if (object instanceof ITask) {
+ AbstractTask task = ((AbstractTask) object);
+ elements.remove(task);
+ String owner = task.getOwner();
+ if (owner == null) {
+ owner = Messages.SearchResultTreeContentProvider__unknown_;
}
- } else {
- completeIncomplete = completeState.get(Messages.SearchResultTreeContentProvider_Incomplete);
- if (completeIncomplete == null) {
- completeIncomplete = new TaskGroup(
- "group-incomplete", Messages.SearchResultTreeContentProvider_Incomplete, GroupBy.COMPLETION.name()); //$NON-NLS-1$
- completeState.put(Messages.SearchResultTreeContentProvider_Incomplete, completeIncomplete);
+ Person person = owners.get(owner);
+ person.internalRemoveChild(task);
+
+ TaskGroup completeIncomplete = null;
+ if (task.isCompleted()) {
+ completeIncomplete = completeState.get(Messages.SearchResultTreeContentProvider_Complete);
+ } else {
+ completeIncomplete = completeState.get(Messages.SearchResultTreeContentProvider_Incomplete);
}
+ completeIncomplete.internalRemoveChild(task);
}
- completeIncomplete.internalAddChild(task);
}
}
}

Back to the top