Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2007-06-14 05:19:46 +0000
committermkersten2007-06-14 05:19:46 +0000
commit42effc463cd59d147091026dfd682bbaaab00f60 (patch)
treeefd7a9747e9b454e6569a1f442f104375bef5784
parente585f7ba481865ea60285fe9e16ab111e98ff8bc (diff)
downloadorg.eclipse.mylyn.tasks-42effc463cd59d147091026dfd682bbaaab00f60.tar.gz
org.eclipse.mylyn.tasks-42effc463cd59d147091026dfd682bbaaab00f60.tar.xz
org.eclipse.mylyn.tasks-42effc463cd59d147091026dfd682bbaaab00f60.zip
RESOLVED - bug 165880: [api] Listeners API should allow to pass multiple events in one call
https://bugs.eclipse.org/bugs/show_bug.cgi?id=165880
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTaskTest.java1
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/TaskEditorTest.java1
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/NewBugzillaTaskWizard.java1
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ScheduledTaskDelegate.java24
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTask.java25
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTaskContainer.java50
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DelegatingTaskExternalizer.java13
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskListChangeListener.java30
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskContainerDelta.java43
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskList.java179
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListManagerTest.java12
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListUiTest.java19
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/CategoryEditorInput.java9
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskPlanningEditor.java55
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskListSaveManager.java33
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/CustomTaskListDecorationDrawer.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TableDecoratingLabelProvider.java1
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskActivityLabelProvider.java3
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskElementLabelProvider.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListContentProvider.java6
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListDropAdapter.java15
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListFilteredTree.java32
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListToolTipHandler.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java297
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskTableLabelProvider.java1
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingset/TaskElementFactory.java1
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingset/TaskWorkingSetUpdater.java59
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/AbstractRepositoryConnectorUi.java1
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/RepositorySynchronizationManager.java11
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/SynchronizeQueryJob.java9
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/SynchronizeTaskJob.java6
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskListManager.java50
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiUtil.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditor.java48
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/RepositoryTaskEditorDropListener.java1
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java5
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditorInput.java1
-rw-r--r--org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracTaskDataHandler.java1
-rw-r--r--org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracRepositoryConnectorTest.java1
39 files changed, 518 insertions, 540 deletions
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTaskTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTaskTest.java
index b6be6b862..9c9862b66 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTaskTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTaskTest.java
@@ -24,7 +24,6 @@ import org.eclipse.mylyn.internal.bugzilla.core.BugzillaTask;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaTaskDataHandler;
import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.AbstractTask;
import org.eclipse.mylyn.tasks.core.RepositoryTaskAttribute;
import org.eclipse.mylyn.tasks.core.RepositoryTaskData;
import org.eclipse.mylyn.tasks.core.TaskComment;
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/TaskEditorTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/TaskEditorTest.java
index c486669d0..6fb2a94f3 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/TaskEditorTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/TaskEditorTest.java
@@ -14,7 +14,6 @@ import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttributeFactory;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaRepositoryConnector;
import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants;
-import org.eclipse.mylyn.tasks.core.AbstractTask;
import org.eclipse.mylyn.tasks.core.RepositoryTaskData;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.TasksUiPlugin;
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/NewBugzillaTaskWizard.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/NewBugzillaTaskWizard.java
index a8f1af2ff..5b3dd79fa 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/NewBugzillaTaskWizard.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/NewBugzillaTaskWizard.java
@@ -17,7 +17,6 @@ import org.eclipse.jface.wizard.Wizard;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttributeFactory;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin;
import org.eclipse.mylyn.internal.bugzilla.ui.BugzillaUiPlugin;
-import org.eclipse.mylyn.tasks.core.AbstractTask;
import org.eclipse.mylyn.tasks.core.RepositoryTaskData;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.TasksUiPlugin;
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ScheduledTaskDelegate.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ScheduledTaskDelegate.java
index c09ec87dc..68dd9dbbd 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ScheduledTaskDelegate.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ScheduledTaskDelegate.java
@@ -16,7 +16,6 @@ import java.util.Date;
import java.util.Set;
import org.eclipse.mylyn.tasks.core.AbstractTask;
-import org.eclipse.mylyn.tasks.core.AbstractTaskCategory;
import org.eclipse.mylyn.tasks.core.AbstractTaskContainer;
/**
@@ -106,12 +105,9 @@ public class ScheduledTaskDelegate extends AbstractTask {
return parent;
}
-// public void addSubTask(ITask task) {
-// task.addSubTask(task);
-// }
-
- public AbstractTaskCategory getCategory() {
- return task.getCategory();
+ @Override
+ public Set<AbstractTaskContainer> getParentContainers() {
+ return task.getParentContainers();
}
public Set<AbstractTask> getChildren() {
@@ -174,16 +170,18 @@ public class ScheduledTaskDelegate extends AbstractTask {
return task.isPastReminder();
}
-// public void removeSubTask(ITask task) {
-// task.removeSubTask(task);
-// }
-
public void setActive(boolean active) {
task.setActive(active);
}
- public void setCategory(AbstractTaskCategory category) {
- task.setCategory(category);
+ @Override
+ public void addParentContainer(AbstractTaskContainer container) {
+ task.addParentContainer(container);
+ }
+
+ @Override
+ public void removeParentContainer(AbstractTaskContainer container) {
+ task.removeParentContainer(container);
}
public void setCompleted(boolean completed) {
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTask.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTask.java
index 424cb4846..4fb65a10f 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTask.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTask.java
@@ -14,6 +14,8 @@ package org.eclipse.mylyn.tasks.core;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.mylyn.internal.tasks.core.RepositoryTaskHandleUtil;
@@ -48,9 +50,7 @@ public abstract class AbstractTask extends AbstractTaskContainer {
private String taskUrl = "";
-
- @Deprecated
- private AbstractTaskCategory parentCategory = null;
+ private Set<AbstractTaskContainer> containers = new HashSet<AbstractTaskContainer>();
// ************ Synch ****************
@@ -340,18 +340,19 @@ public abstract class AbstractTask extends AbstractTaskContainer {
}
/**
- * Use TaskList for moving tasks between containers
- *
- * TODO: get rid of this or we should make TaskCategory API.
+ * Limitation: can currently only add one container.
*/
- @Deprecated
- public void setCategory(AbstractTaskCategory category) {
- this.parentCategory = category;
+ public void addParentContainer(AbstractTaskContainer container) {
+ containers.clear();
+ containers.add(container);
}
- @Deprecated
- public AbstractTaskCategory getCategory() {
- return parentCategory;
+ public void removeParentContainer(AbstractTaskContainer container) {
+ containers.remove(container);
+ }
+
+ public Set<AbstractTaskContainer> getParentContainers() {
+ return containers;
}
public String getSummary() {
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTaskContainer.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTaskContainer.java
index cb6ef591b..18572ee23 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTaskContainer.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTaskContainer.java
@@ -39,6 +39,29 @@ public abstract class AbstractTaskContainer extends PlatformObject implements Co
this.handle = handleAndDescription;
}
+ /**
+ * Use {@link TaskList} methods instead.
+ */
+ @Deprecated
+ protected void addChild(AbstractTask task) {
+ children.add(task);
+ }
+
+ /**
+ * Does not delete task from TaskList
+ */
+ @Deprecated
+ protected void removeChild(AbstractTask task) {
+ children.remove(task);
+ }
+
+ /**
+ * Does not delete tasks from TaskList
+ */
+ public void clear() {
+ children.clear();
+ }
+
public Set<AbstractTask> getChildren() {
return Collections.unmodifiableSet(children);
}
@@ -75,39 +98,18 @@ public abstract class AbstractTaskContainer extends PlatformObject implements Co
this.handle = handle;
}
- /**
- * Use {@link TaskList} methods instead.
- */
- @Deprecated
- protected void add(AbstractTask task) {
- children.add(task);
- }
-
- /**
- * Does not delete task from TaskList
- */
- @Deprecated
- protected void remove(AbstractTask task) {
- children.remove(task);
- }
-
- /**
- * Does not delete tasks from TaskList
- */
- public void clear() {
- children.clear();
- }
-
@Override
public int hashCode() {
return handle.hashCode();
}
- @Deprecated
public void setUrl(String url) {
this.url = url;
}
+ /**
+ * @return can be null
+ */
public String getUrl() {
return url;
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DelegatingTaskExternalizer.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DelegatingTaskExternalizer.java
index 077ded3dc..10c0f6dee 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DelegatingTaskExternalizer.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DelegatingTaskExternalizer.java
@@ -165,11 +165,12 @@ public class DelegatingTaskExternalizer implements ITaskListExternalizer {
node.setAttribute(KEY_LABEL, stripControlCharacters(task.getSummary()));
node.setAttribute(KEY_HANDLE, task.getHandleIdentifier());
- if (task.getCategory() != null) {
- if (task.getCategory().getHandleIdentifier().equals(UnfiledCategory.HANDLE)) {
+ AbstractTaskContainer container = task.getParentContainers().iterator().next();
+ if (container != null) {
+ if (container.getHandleIdentifier().equals(UnfiledCategory.HANDLE)) {
node.setAttribute(KEY_CATEGORY, VAL_ROOT);
} else {
- node.setAttribute(KEY_CATEGORY, task.getCategory().getHandleIdentifier());
+ node.setAttribute(KEY_CATEGORY, container.getHandleIdentifier());
}
} else {
// TODO: if/when subtasks are supported this should be handled
@@ -303,7 +304,7 @@ public class DelegatingTaskExternalizer implements ITaskListExternalizer {
Node child = list.item(i);
try {
// LEGACY: categories used to contain tasks?
- category.add(readTask(child, taskList, category, null));
+ category.addChild(readTask(child, taskList, category, null));
// boolean read = false;
// for (ITaskListExternalizer externalizer :
// delegateExternalizers) {
@@ -403,8 +404,8 @@ public class DelegatingTaskExternalizer implements ITaskListExternalizer {
taskList.internalAddRootTask(task);
}
} else if (legacyCategory != null && !(legacyCategory instanceof TaskArchive)) {
- task.setCategory(legacyCategory);
- legacyCategory.add(task);
+ task.addParentContainer(legacyCategory);
+ legacyCategory.addChild(task);
} else if (legacyCategory == null && parent == null) {
if (task instanceof AbstractTask) {
taskList.internalAddTask(task, taskList.getArchiveContainer());
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskListChangeListener.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskListChangeListener.java
index f1b4cf740..b12af7eeb 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskListChangeListener.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskListChangeListener.java
@@ -11,6 +11,8 @@
package org.eclipse.mylyn.tasks.core;
+import java.util.Set;
+
/**
* Listener for task list modifications and task content modifications.
@@ -19,32 +21,6 @@ package org.eclipse.mylyn.tasks.core;
*/
public interface ITaskListChangeListener {
- /**
- * called when task changes state (incoming/outgoing/synchronizing...)
- */
- public abstract void localInfoChanged(AbstractTask task);
-
- /**
- * Called when task data (repository task data or edits) have changed
- * TODO: Extract into separate interface
- */
- public abstract void repositoryInfoChanged(AbstractTask task);
+ public abstract void containersChanged(Set<TaskContainerDelta> containers);
- public abstract void taskDeleted(AbstractTask task);
-
- public abstract void containerAdded(AbstractTaskContainer container);
-
- public abstract void containerDeleted(AbstractTaskContainer container);
-
- public abstract void containerInfoChanged(AbstractTaskContainer container);
-
- /**
- * @param task
- * @param fromContainer can be null
- * @param toContainer can be null
- */
- public abstract void taskMoved(AbstractTask task, AbstractTaskContainer fromContainer, AbstractTaskContainer toContainer);
-
- public abstract void taskAdded(AbstractTask task);
-
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskContainerDelta.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskContainerDelta.java
new file mode 100644
index 000000000..4a28f9672
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskContainerDelta.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2004 - 2006 University Of British Columbia 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:
+ * University Of British Columbia - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.tasks.core;
+
+
+/**
+ * Immutable.
+ *
+ * @author Mik Kersten
+ */
+public final class TaskContainerDelta {
+
+ public enum Kind {
+ ADDED, REMOVED, CHANGED
+ }
+
+ private final AbstractTaskContainer container;
+
+ private final Kind kind;
+
+ public TaskContainerDelta(AbstractTaskContainer container, Kind kind) {
+ this.container = container;
+ this.kind = kind;
+ }
+
+ public AbstractTaskContainer getContainer() {
+ return container;
+ }
+
+ public Kind getKind() {
+ return kind;
+ }
+
+}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskList.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskList.java
index 3173c5ca7..4dae6073b 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskList.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskList.java
@@ -74,7 +74,7 @@ public class TaskList {
}
public void addTask(AbstractTask task) {
- addTask(task, archiveContainer);
+ addTask(task, null);
}
/**
@@ -94,44 +94,51 @@ public class TaskList {
return result;
}
-
/**
* Precondition: {@code container} already exists in tasklist (be it a parent task, category, or query)
- * @param task to be added (hit, subtask, etc)
- * @param container task container, query or parent task
+ *
+ * @param task
+ * to be added (hit, subtask, etc)
+ * @param container
+ * task container, query or parent task
*/
- public void addTask(AbstractTask task, AbstractTaskContainer parentElement) {
+ public void addTask(AbstractTask task, AbstractTaskContainer parentContainer) {
+ if (task == null) {
+ return;
+ }
AbstractTask newTask = tasks.get(task.getHandleIdentifier());
if (newTask == null) {
newTask = task;
tasks.put(newTask.getHandleIdentifier(), newTask);
- archiveContainer.add(newTask);
- newTask.setCategory(archiveContainer);
+ archiveContainer.addChild(newTask);
+// newTask.addParentContainer(archiveContainer);
+
+ // NOTE: only called for newly-created tasks
+ Set<TaskContainerDelta> delta = new HashSet<TaskContainerDelta>();
+ delta.add(new TaskContainerDelta(newTask, TaskContainerDelta.Kind.ADDED));
for (ITaskListChangeListener listener : changeListeners) {
- listener.taskAdded(newTask);
+ listener.containersChanged(delta);
}
}
- if (parentElement != null) {
- parentElement.add(newTask);
- if (parentElement instanceof TaskCategory) {
- newTask.setCategory((TaskCategory)parentElement);
+ if (parentContainer != null) {
+ parentContainer.addChild(newTask);
+ if ((parentContainer instanceof AbstractTaskCategory && ((AbstractTaskCategory) parentContainer).isUserDefined())) {
+ newTask.addParentContainer((TaskCategory) parentContainer);
}
} else {
- automaticCategory.add(newTask);
- newTask.setCategory(automaticCategory);
+ automaticCategory.addChild(newTask);
+ newTask.addParentContainer(automaticCategory);
}
}
-
public void refactorRepositoryUrl(String oldRepositoryUrl, String newRepositoryUrl) {
for (AbstractTask task : tasks.values()) {
if (task instanceof AbstractTask) {
AbstractTask repositoryTask = (AbstractTask) task;
- if (oldRepositoryUrl.equals(RepositoryTaskHandleUtil.getRepositoryUrl(repositoryTask
- .getHandleIdentifier()))) {
+ if (oldRepositoryUrl.equals(RepositoryTaskHandleUtil.getRepositoryUrl(repositoryTask.getHandleIdentifier()))) {
tasks.remove(repositoryTask.getHandleIdentifier());
repositoryTask.setRepositoryUrl(newRepositoryUrl);
tasks.put(repositoryTask.getHandleIdentifier(), repositoryTask);
@@ -144,16 +151,19 @@ public class TaskList {
}
}
+ Set<TaskContainerDelta> delta = new HashSet<TaskContainerDelta>();
for (AbstractRepositoryQuery query : queries.values()) {
if (query.getRepositoryUrl().equals(oldRepositoryUrl)) {
query.setRepositoryUrl(newRepositoryUrl);
- for (ITaskListChangeListener listener : changeListeners) {
- listener.containerInfoChanged(query);
- }
+ delta.add(new TaskContainerDelta(query, TaskContainerDelta.Kind.CHANGED));
}
}
+ for (ITaskListChangeListener listener : changeListeners) {
+ listener.containersChanged(delta);
+ }
}
+ @Deprecated
public void moveToRoot(AbstractTask task) {
moveToContainer(automaticCategory, task);
}
@@ -162,10 +172,18 @@ public class TaskList {
if (!tasks.containsKey(task.getHandleIdentifier())) {
tasks.put(task.getHandleIdentifier(), task);
}
+ Set<TaskContainerDelta> delta = new HashSet<TaskContainerDelta>();
+ delta.add(new TaskContainerDelta(toContainer, TaskContainerDelta.Kind.CHANGED));
- AbstractTaskCategory fromContainer = task.getCategory();
- if (fromContainer instanceof AbstractTaskCategory) {
- (fromContainer).remove(task);
+ Set<AbstractTaskContainer> currentContainers = task.getParentContainers();
+ for (AbstractTaskContainer taskContainer : currentContainers) {
+ if (taskContainer instanceof AbstractTaskCategory) {
+ if (!(taskContainer instanceof TaskArchive)) {
+ (taskContainer).removeChild(task);
+ }
+ task.removeParentContainer(taskContainer);
+ delta.add(new TaskContainerDelta(taskContainer, TaskContainerDelta.Kind.CHANGED));
+ }
}
if (toContainer != null) {
internalAddTask(task, toContainer);
@@ -173,14 +191,17 @@ public class TaskList {
internalAddTask(task, archiveContainer);
}
for (ITaskListChangeListener listener : changeListeners) {
- listener.taskMoved(task, fromContainer, toContainer);
+ listener.containersChanged(delta);
}
}
public void addCategory(TaskCategory category) {
categories.put(category.getHandleIdentifier(), category);
+
+ Set<TaskContainerDelta> delta = new HashSet<TaskContainerDelta>();
+ delta.add(new TaskContainerDelta(category, TaskContainerDelta.Kind.ADDED));
for (ITaskListChangeListener listener : changeListeners) {
- listener.containerAdded(category);
+ listener.containersChanged(delta);
}
}
@@ -194,8 +215,12 @@ public class TaskList {
public void renameTask(AbstractTask task, String description) {
task.setSummary(description);
+
+ Set<TaskContainerDelta> delta = new HashSet<TaskContainerDelta>();
+ delta.add(new TaskContainerDelta(task, TaskContainerDelta.Kind.CHANGED));
+
for (ITaskListChangeListener listener : changeListeners) {
- listener.localInfoChanged(task);
+ listener.containersChanged(delta);
}
}
@@ -213,61 +238,80 @@ public class TaskList {
}
} else if (container instanceof TaskCategory && categories.remove(container.getHandleIdentifier()) != null) {
container.setDescription(newDescription);
- this.addCategory((TaskCategory)container);
+ this.addCategory((TaskCategory) container);
}
}
+ Set<TaskContainerDelta> delta = new HashSet<TaskContainerDelta>();
+ delta.add(new TaskContainerDelta(container, TaskContainerDelta.Kind.CHANGED));
for (ITaskListChangeListener listener : changeListeners) {
- listener.containerInfoChanged(container);
+ listener.containersChanged(delta);
}
}
public void addQuery(AbstractRepositoryQuery query) {
queries.put(query.getHandleIdentifier(), query);
+ Set<TaskContainerDelta> delta = new HashSet<TaskContainerDelta>();
+ delta.add(new TaskContainerDelta(query, TaskContainerDelta.Kind.ADDED));
for (ITaskListChangeListener listener : changeListeners) {
- listener.containerAdded(query);
+ listener.containersChanged(delta);
}
}
/**
* TODO: refactor around querying containers for their tasks
*
- * Task is removed from all containers: root, archive, category, and tasks
- * catchall (Currently no support for deletion of subtasks)
+ * Task is removed from all containers: root, archive, category, and tasks catchall (Currently no support for
+ * deletion of subtasks)
*/
public void deleteTask(AbstractTask task) {
- archiveContainer.remove(task);
- automaticCategory.remove(task);
- if (task.getCategory() != null) {
- task.getCategory().remove(task);
- task.setCategory(null);
+ archiveContainer.removeChild(task);
+ automaticCategory.removeChild(task);
+
+ for (AbstractTaskContainer container : task.getParentContainers()) {
+ container.removeChild(task);
+ task.removeParentContainer(container);
}
tasks.remove(task.getHandleIdentifier());
+
+ Set<TaskContainerDelta> delta = new HashSet<TaskContainerDelta>();
+ delta.add(new TaskContainerDelta(task, TaskContainerDelta.Kind.REMOVED));
for (ITaskListChangeListener listener : changeListeners) {
- listener.taskDeleted(task);
+ listener.containersChanged(delta);
}
}
public void deleteCategory(AbstractTaskCategory category) {
for (AbstractTask task : category.getChildren()) {
- automaticCategory.add(task);
+ automaticCategory.addChild(task);
}
categories.remove(category.getHandleIdentifier());
+
+ Set<TaskContainerDelta> delta = new HashSet<TaskContainerDelta>();
+ delta.add(new TaskContainerDelta(automaticCategory, TaskContainerDelta.Kind.CHANGED));
+ delta.add(new TaskContainerDelta(category, TaskContainerDelta.Kind.CHANGED));
+
for (ITaskListChangeListener listener : changeListeners) {
- listener.containerDeleted(category);
+ listener.containersChanged(delta);
}
}
public void deleteQuery(AbstractRepositoryQuery query) {
queries.remove(query.getHandleIdentifier());
+
+ Set<TaskContainerDelta> delta = new HashSet<TaskContainerDelta>();
+ delta.add(new TaskContainerDelta(query, TaskContainerDelta.Kind.REMOVED));
for (ITaskListChangeListener listener : changeListeners) {
- listener.containerDeleted(query);
+ listener.containersChanged(delta);
}
}
public void markComplete(AbstractTask task, boolean complete) {
task.setCompleted(complete);
+
+ Set<TaskContainerDelta> delta = new HashSet<TaskContainerDelta>();
+ delta.add(new TaskContainerDelta(task, TaskContainerDelta.Kind.CHANGED));
for (ITaskListChangeListener listener : new ArrayList<ITaskListChangeListener>(changeListeners)) {
- listener.localInfoChanged(task);
+ listener.containersChanged(delta);
}
}
@@ -289,13 +333,13 @@ public class TaskList {
public void internalAddTask(AbstractTask task, AbstractTaskCategory container) {
tasks.put(task.getHandleIdentifier(), task);
if (container != null) {
- container.add(task);
+ container.addChild(task);
if (container instanceof TaskCategory) {
- task.setCategory((AbstractTaskCategory)container);
+ task.addParentContainer(container);
}
} else {
- task.setCategory(automaticCategory);
- automaticCategory.add(task);
+ automaticCategory.addChild(task);
+ task.addParentContainer(automaticCategory);
}
}
@@ -564,35 +608,38 @@ public class TaskList {
return Collections.unmodifiableSet(changeListeners);
}
- /**
- * TODO: refactor into task deltas?
- */
- public void notifyLocalInfoChanged(AbstractTask task) {
+ public void notifyTaskChanged(AbstractTask task) {
for (ITaskListChangeListener listener : new ArrayList<ITaskListChangeListener>(changeListeners)) {
try {
- listener.localInfoChanged(task);
+ Set<TaskContainerDelta> delta = new HashSet<TaskContainerDelta>();
+ delta.add(new TaskContainerDelta(task, TaskContainerDelta.Kind.CHANGED));
+ listener.containersChanged(delta);
} catch (Throwable t) {
- MylarStatusHandler.fail(t, "notification failed for: " + listener, false);
+ MylarStatusHandler.fail(t, "Notification failed for: " + listener, false);
}
}
}
- public void notifyRepositoryInfoChanged(AbstractTask task) {
- for (ITaskListChangeListener listener : new ArrayList<ITaskListChangeListener>(changeListeners)) {
- try {
- listener.repositoryInfoChanged(task);
- } catch (Throwable t) {
- MylarStatusHandler.fail(t, "notification failed for: " + listener, false);
+ public void notifyContainersUpdated(Set<? extends AbstractTaskContainer> containers) {
+ if (containers == null) {
+ for (ITaskListChangeListener listener : new ArrayList<ITaskListChangeListener>(changeListeners)) {
+ try {
+ listener.containersChanged(null);
+ } catch (Throwable t) {
+ MylarStatusHandler.fail(t, "notification failed for: " + listener, false);
+ }
}
- }
- }
-
- public void notifyContainerUpdated(AbstractTaskContainer container) {
- for (ITaskListChangeListener listener : new ArrayList<ITaskListChangeListener>(changeListeners)) {
- try {
- listener.containerInfoChanged(container);
- } catch (Throwable t) {
- MylarStatusHandler.fail(t, "notification failed for: " + listener, false);
+ } else {
+ Set<TaskContainerDelta> delta = new HashSet<TaskContainerDelta>();
+ for (AbstractTaskContainer abstractTaskContainer : containers) {
+ delta.add(new TaskContainerDelta(abstractTaskContainer, TaskContainerDelta.Kind.CHANGED));
+ }
+ for (ITaskListChangeListener listener : new ArrayList<ITaskListChangeListener>(changeListeners)) {
+ try {
+ listener.containersChanged(delta);
+ } catch (Throwable t) {
+ MylarStatusHandler.fail(t, "notification failed for: " + listener, false);
+ }
}
}
}
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListManagerTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListManagerTest.java
index 20845d512..6109fee27 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListManagerTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListManagerTest.java
@@ -301,19 +301,19 @@ public class TaskListManagerTest extends TestCase {
AbstractTask task1 = new LocalTask("t1", "t1");
manager.getTaskList().moveToRoot(task1);
assertEquals(1, manager.getTaskList().getRootTasks().size());
- assertEquals(UnfiledCategory.HANDLE, task1.getCategory().getHandleIdentifier());
+ assertEquals(UnfiledCategory.HANDLE, task1.getParentContainers().iterator().next().getHandleIdentifier());
TaskCategory cat1 = new TaskCategory("c1");
manager.getTaskList().addCategory(cat1);
manager.getTaskList().moveToContainer(cat1, task1);
assertEquals(0, manager.getTaskList().getRootTasks().size());
- assertEquals(cat1, task1.getCategory());
+ assertEquals(cat1, task1.getParentContainers().iterator().next());
manager.getTaskList().moveToRoot(task1);
assertEquals(1, manager.getTaskList().getRootTasks().size());
assertEquals(0, cat1.getChildren().size());
- assertEquals(UnfiledCategory.HANDLE, task1.getCategory().getHandleIdentifier());
+ assertEquals(UnfiledCategory.HANDLE, task1.getParentContainers().iterator().next().getHandleIdentifier());
}
public void testEmpty() {
@@ -473,7 +473,7 @@ public class TaskListManagerTest extends TestCase {
MockRepositoryTask reportInCat1 = new MockRepositoryTask("123");
manager.getTaskList().moveToContainer(cat1, reportInCat1);
- assertEquals(cat1, reportInCat1.getCategory());
+ assertEquals(cat1, reportInCat1.getParentContainers().iterator().next());
manager.saveTaskList();
assertNotNull(manager.getTaskList());
@@ -529,7 +529,7 @@ public class TaskListManagerTest extends TestCase {
AbstractTask task3 =manager.createNewLocalTask("task 3");
manager.getTaskList().moveToContainer(cat1, task3);
cat1Contents.add(task3);
- assertEquals(cat1, task3.getCategory());
+ assertEquals(cat1, task3.getParentContainers().iterator().next());
AbstractTask sub2 = manager.createNewLocalTask("sub 2");
manager.getTaskList().addTask(sub2, task3);
manager.getTaskList().moveToContainer(manager.getTaskList().getArchiveContainer(), sub2);
@@ -540,7 +540,7 @@ public class TaskListManagerTest extends TestCase {
MockRepositoryTask reportInCat1 = new MockRepositoryTask("123");
manager.getTaskList().moveToContainer(cat1, reportInCat1);
- assertEquals(cat1, reportInCat1.getCategory());
+ assertEquals(cat1, reportInCat1.getParentContainers().iterator().next());
cat1Contents.add(reportInCat1);
MockRepositoryTask reportInRoot = new MockRepositoryTask("124");
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListUiTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListUiTest.java
index b3332b213..c81ac5796 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListUiTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListUiTest.java
@@ -28,7 +28,6 @@ import org.eclipse.mylyn.internal.tasks.ui.actions.MarkTaskCompleteAction;
import org.eclipse.mylyn.internal.tasks.ui.actions.NewCategoryAction;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
import org.eclipse.mylyn.tasks.core.AbstractTask;
-import org.eclipse.mylyn.tasks.core.AbstractTask;
import org.eclipse.mylyn.tasks.core.ITaskListChangeListener;
import org.eclipse.mylyn.tasks.core.AbstractTaskContainer;
import org.eclipse.mylyn.tasks.core.TaskCategory;
@@ -103,24 +102,24 @@ public class TaskListUiTest extends TestCase {
cat1task2 = manager.createNewLocalTask("task 2");
cat1task2.setPriority(PriorityLevel.P2.toString());
- cat1task2.setCategory(cat1);
+ cat1task2.addParentContainer(cat1);
manager.getTaskList().moveToContainer(cat1, cat1task2);
cat1task3 = manager.createNewLocalTask("task 3");
cat1task3.setPriority(PriorityLevel.P3.toString());
cat1task3.setCompleted(true);
- cat1task3.setCategory(cat1);
+ cat1task3.addParentContainer(cat1);
manager.getTaskList().moveToContainer(cat1, cat1task3);
cat1task4 = manager.createNewLocalTask("task 4");
cat1task4.setPriority(PriorityLevel.P4.toString());
- cat1task4.setCategory(cat1);
+ cat1task4.addParentContainer(cat1);
manager.getTaskList().moveToContainer(cat1, cat1task4);
cat1task5 = manager.createNewLocalTask("task 5");
cat1task5.setPriority(PriorityLevel.P5.toString());
cat1task5.setCompleted(true);
- cat1task5.setCategory(cat1);
+ cat1task5.addParentContainer(cat1);
manager.getTaskList().moveToContainer(cat1, cat1task5);
manager.getTaskList().addCategory(cat1);
@@ -130,7 +129,7 @@ public class TaskListUiTest extends TestCase {
cat2task1 = manager.createNewLocalTask("task 1");
cat2task1.setPriority(PriorityLevel.P1.toString());
- cat2task1.setCategory(cat2);
+ cat2task1.addParentContainer(cat2);
manager.getTaskList().moveToContainer(cat2, cat2task1);
cat2task1sub1 = manager.createNewLocalTask("sub task 1");
@@ -140,23 +139,23 @@ public class TaskListUiTest extends TestCase {
cat2task2 = manager.createNewLocalTask("task 2");
cat2task2.setPriority(PriorityLevel.P2.toString());
cat2task2.setCompleted(true);
- cat2task2.setCategory(cat2);
+ cat2task2.addParentContainer(cat2);
manager.getTaskList().moveToContainer(cat2, cat2task2);
cat2task3 = manager.createNewLocalTask("task 3");
cat2task3.setPriority(PriorityLevel.P3.toString());
- cat2task3.setCategory(cat2);
+ cat2task3.addParentContainer(cat2);
manager.getTaskList().moveToContainer(cat2, cat2task3);
cat2task4 = manager.createNewLocalTask("task 4");
cat2task4.setPriority(PriorityLevel.P4.toString());
cat2task4.setCompleted(true);
- cat2task4.setCategory(cat2);
+ cat2task4.addParentContainer(cat2);
manager.getTaskList().moveToContainer(cat2, cat2task4);
cat2task5 = manager.createNewLocalTask("task 5");
cat2task5.setPriority(PriorityLevel.P5.toString());
- cat2task5.setCategory(cat2);
+ cat2task5.addParentContainer(cat2);
manager.getTaskList().moveToContainer(cat2, cat2task5);
manager.getTaskList().addCategory(cat2);
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/CategoryEditorInput.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/CategoryEditorInput.java
index 36e2789c1..46d58ad9a 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/CategoryEditorInput.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/CategoryEditorInput.java
@@ -11,7 +11,11 @@
package org.eclipse.mylyn.internal.tasks.ui.editors;
+import java.util.HashSet;
+import java.util.Set;
+
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.mylyn.tasks.core.AbstractTaskContainer;
import org.eclipse.mylyn.tasks.core.TaskCategory;
import org.eclipse.mylyn.tasks.ui.TasksUiPlugin;
import org.eclipse.ui.IEditorInput;
@@ -68,7 +72,10 @@ public class CategoryEditorInput implements IEditorInput {
public void setUrl(String url) {
category.setUrl(url);
- TasksUiPlugin.getTaskListManager().getTaskList().notifyContainerUpdated(category);
+ Set<AbstractTaskContainer> updated = new HashSet<AbstractTaskContainer>();
+ updated.add(category);
+ TasksUiPlugin.getTaskListManager().getTaskList().notifyContainersUpdated(updated);
+// .notifyContainerUpdated(category);
}
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskPlanningEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskPlanningEditor.java
index 8640bae87..995b5d013 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskPlanningEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskPlanningEditor.java
@@ -14,6 +14,7 @@ package org.eclipse.mylyn.internal.tasks.ui.editors;
import java.io.File;
import java.text.DateFormat;
import java.util.Calendar;
+import java.util.Set;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.layout.GridDataFactory;
@@ -28,9 +29,8 @@ import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
import org.eclipse.mylyn.monitor.core.DateUtil;
import org.eclipse.mylyn.monitor.ui.MonitorUiPlugin;
import org.eclipse.mylyn.tasks.core.AbstractTask;
-import org.eclipse.mylyn.tasks.core.AbstractTaskContainer;
-import org.eclipse.mylyn.tasks.core.AbstractTask;
import org.eclipse.mylyn.tasks.core.ITaskListChangeListener;
+import org.eclipse.mylyn.tasks.core.TaskContainerDelta;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.core.AbstractTask.PriorityLevel;
import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
@@ -135,49 +135,24 @@ public class TaskPlanningEditor extends TaskFormPage {
private ITaskListChangeListener TASK_LIST_LISTENER = new ITaskListChangeListener() {
- public void localInfoChanged(final AbstractTask updateTask) {
- if (updateTask != null && task != null
- && updateTask.getHandleIdentifier().equals(task.getHandleIdentifier())) {
- if (PlatformUI.getWorkbench() != null && !PlatformUI.getWorkbench().isClosing()) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
-
- updateTaskData(updateTask);
+ public void containersChanged(Set<TaskContainerDelta> containers) {
+ for (TaskContainerDelta taskContainerDelta : containers) {
+ if (taskContainerDelta.getContainer() instanceof AbstractTask) {
+ final AbstractTask updateTask = (AbstractTask)taskContainerDelta.getContainer();
+ if (updateTask != null && task != null
+ && updateTask.getHandleIdentifier().equals(task.getHandleIdentifier())) {
+ if (PlatformUI.getWorkbench() != null && !PlatformUI.getWorkbench().isClosing()) {
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ updateTaskData(updateTask);
+ }
+ });
}
-
- });
+ }
}
}
}
- public void repositoryInfoChanged(AbstractTask task) {
- localInfoChanged(task);
- }
-
- public void taskMoved(AbstractTask task, AbstractTaskContainer fromContainer, AbstractTaskContainer toContainer) {
- // ignore
- }
-
- public void taskDeleted(AbstractTask task) {
- // ignore
- }
-
- public void containerAdded(AbstractTaskContainer container) {
- // ignore
- }
-
- public void containerDeleted(AbstractTaskContainer container) {
- // ignore
- }
-
- public void taskAdded(AbstractTask task) {
- // ignore
- }
-
- public void containerInfoChanged(AbstractTaskContainer container) {
- // ignore
- }
-
};
private FormToolkit toolkit;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskListSaveManager.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskListSaveManager.java
index 5bd342a54..05aaf5657 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskListSaveManager.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskListSaveManager.java
@@ -21,6 +21,7 @@ import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
+import java.util.Set;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -31,9 +32,9 @@ import org.eclipse.mylyn.context.core.ContextCorePlugin;
import org.eclipse.mylyn.core.MylarStatusHandler;
import org.eclipse.mylyn.internal.context.core.InteractionContextManager;
import org.eclipse.mylyn.internal.tasks.ui.ITasksUiConstants;
-import org.eclipse.mylyn.tasks.core.AbstractTaskContainer;
import org.eclipse.mylyn.tasks.core.AbstractTask;
import org.eclipse.mylyn.tasks.core.ITaskListChangeListener;
+import org.eclipse.mylyn.tasks.core.TaskContainerDelta;
import org.eclipse.mylyn.tasks.ui.TaskListManager;
import org.eclipse.mylyn.tasks.ui.TasksUiPlugin;
import org.eclipse.ui.PlatformUI;
@@ -232,40 +233,12 @@ public class TaskListSaveManager implements ITaskListChangeListener, IBackground
// ignore
}
-// /**
-// * For testing.
-// */
-// public void setForceBackgroundSave(boolean on) {
-// forceBackgroundSave = on;
-// // saveTimer.setForceSyncExec(on);
-// }
-
- public void taskMoved(AbstractTask task, AbstractTaskContainer fromContainer, AbstractTaskContainer toContainer) {
- saveTaskList(false, true);
- }
-
- public void taskDeleted(AbstractTask task) {
- saveTaskList(false, true);
- }
-
- public void containerAdded(AbstractTaskContainer container) {
- saveTaskList(false, true);
- }
-
- public void containerDeleted(AbstractTaskContainer container) {
- saveTaskList(false, true);
- }
-
- public void taskAdded(AbstractTask task) {
- saveTaskList(false, true);
- }
-
/** For testing only * */
public BackgroundSaveTimer getSaveTimer() {
return saveTimer;
}
- public void containerInfoChanged(AbstractTaskContainer container) {
+ public void containersChanged(Set<TaskContainerDelta> containers) {
saveTaskList(false, true);
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/CustomTaskListDecorationDrawer.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/CustomTaskListDecorationDrawer.java
index 36f8a8a25..51450c0a9 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/CustomTaskListDecorationDrawer.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/CustomTaskListDecorationDrawer.java
@@ -11,10 +11,8 @@ package org.eclipse.mylyn.internal.tasks.ui.views;
import java.util.Arrays;
import org.eclipse.mylyn.context.core.ContextCorePlugin;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPreferenceConstants;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiImages;
-import org.eclipse.mylyn.tasks.core.AbstractTask;
-import org.eclipse.mylyn.tasks.core.AbstractTaskContainer;
+import org.eclipse.mylyn.internal.tasks.ui.TasksUiPreferenceConstants;
import org.eclipse.mylyn.tasks.core.AbstractTask;
import org.eclipse.mylyn.tasks.core.AbstractTaskContainer;
import org.eclipse.mylyn.tasks.core.AbstractTask.RepositoryTaskSyncState;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TableDecoratingLabelProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TableDecoratingLabelProvider.java
index 85f2d46d4..769efb980 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TableDecoratingLabelProvider.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TableDecoratingLabelProvider.java
@@ -18,7 +18,6 @@ import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.mylyn.context.core.ContextCorePlugin;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiImages;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.AbstractTaskContainer;
import org.eclipse.mylyn.tasks.core.AbstractTask;
import org.eclipse.mylyn.tasks.core.AbstractTaskContainer;
import org.eclipse.swt.graphics.Image;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskActivityLabelProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskActivityLabelProvider.java
index ee3f775a4..a130b3917 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskActivityLabelProvider.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskActivityLabelProvider.java
@@ -20,14 +20,13 @@ import org.eclipse.jface.viewers.ILabelDecorator;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.mylyn.core.MylarStatusHandler;
-import org.eclipse.mylyn.internal.tasks.core.ScheduledTaskDelegate;
import org.eclipse.mylyn.internal.tasks.core.ScheduledTaskContainer;
+import org.eclipse.mylyn.internal.tasks.core.ScheduledTaskDelegate;
import org.eclipse.mylyn.internal.tasks.ui.TaskListColorsAndFonts;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiImages;
import org.eclipse.mylyn.monitor.core.DateUtil;
import org.eclipse.mylyn.tasks.core.AbstractTask;
import org.eclipse.mylyn.tasks.core.AbstractTaskContainer;
-import org.eclipse.mylyn.tasks.core.AbstractTask;
import org.eclipse.mylyn.tasks.core.AbstractTask.PriorityLevel;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskElementLabelProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskElementLabelProvider.java
index 042e1913b..3823a95f9 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskElementLabelProvider.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskElementLabelProvider.java
@@ -26,11 +26,9 @@ import org.eclipse.mylyn.internal.tasks.ui.TasksUiImages;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryQuery;
import org.eclipse.mylyn.tasks.core.AbstractTask;
import org.eclipse.mylyn.tasks.core.AbstractTaskContainer;
-import org.eclipse.mylyn.tasks.core.AbstractTask;
-import org.eclipse.mylyn.tasks.core.AbstractTaskContainer;
import org.eclipse.mylyn.tasks.core.TaskCategory;
-import org.eclipse.mylyn.tasks.core.AbstractTask.RepositoryTaskSyncState;
import org.eclipse.mylyn.tasks.core.AbstractTask.PriorityLevel;
+import org.eclipse.mylyn.tasks.core.AbstractTask.RepositoryTaskSyncState;
import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
import org.eclipse.mylyn.tasks.ui.TasksUiPlugin;
import org.eclipse.swt.graphics.Color;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListContentProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListContentProvider.java
index cad2dab91..6c90d1823 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListContentProvider.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListContentProvider.java
@@ -59,13 +59,13 @@ public class TaskListContentProvider implements IStructuredContentProvider, ITre
}
public Object getParent(Object child) {
- if (child instanceof AbstractTask) {
+// if (child instanceof AbstractTask) {
// if (((ITask) child).getParent() != null) {
// return ((ITask) child).getParent();
// } else {
- return ((AbstractTask) child).getCategory();
+// return ((AbstractTask) child).getCategory();
// }
- }
+// }
return null;
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListDropAdapter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListDropAdapter.java
index 21d7cf5a4..de995c2b5 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListDropAdapter.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListDropAdapter.java
@@ -34,7 +34,6 @@ import org.eclipse.mylyn.internal.tasks.ui.actions.TaskActivateAction;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryQuery;
import org.eclipse.mylyn.tasks.core.AbstractTask;
-import org.eclipse.mylyn.tasks.core.AbstractTask;
import org.eclipse.mylyn.tasks.core.AbstractTaskContainer;
import org.eclipse.mylyn.tasks.core.TaskCategory;
import org.eclipse.mylyn.tasks.core.TaskRepository;
@@ -116,10 +115,18 @@ public class TaskListDropAdapter extends ViewerDropAdapter {
TasksUiPlugin.getTaskListManager().getTaskList().moveToContainer((TaskCategory) currentTarget, task);
} else if (currentTarget instanceof AbstractTask) {
AbstractTask targetTask = (AbstractTask) currentTarget;
- if (targetTask.getCategory() == null) {
+ TaskCategory targetCategory = null;
+ // TODO: just look for categories?
+ if (targetTask.getParentContainers().size() == 1) {
+ AbstractTaskContainer container = targetTask.getParentContainers().iterator().next();
+ if (container instanceof TaskCategory) {
+ targetCategory = (TaskCategory)container;
+ }
+ }
+ if (targetCategory == null) {
TasksUiPlugin.getTaskListManager().getTaskList().moveToRoot(task);
} else {
- TasksUiPlugin.getTaskListManager().getTaskList().moveToContainer(targetTask.getCategory(), task);
+ TasksUiPlugin.getTaskListManager().getTaskList().moveToContainer(targetCategory, task);
}
} else if (currentTarget instanceof ScheduledTaskContainer) {
ScheduledTaskContainer container = (ScheduledTaskContainer)currentTarget;
@@ -282,7 +289,7 @@ public class TaskListDropAdapter extends ViewerDropAdapter {
@Override
protected void setTitle(final String pageTitle) {
newTask.setSummary(pageTitle);
- TasksUiPlugin.getTaskListManager().getTaskList().notifyLocalInfoChanged(newTask);
+ TasksUiPlugin.getTaskListManager().getTaskList().notifyTaskChanged(newTask);
}
};
job.schedule();
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListFilteredTree.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListFilteredTree.java
index 523b80ff0..462eee07b 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListFilteredTree.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListFilteredTree.java
@@ -16,10 +16,10 @@ import java.util.Set;
import org.eclipse.jface.layout.TreeColumnLayout;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.mylyn.internal.tasks.core.ScheduledTaskContainer;
-import org.eclipse.mylyn.tasks.core.AbstractTaskContainer;
import org.eclipse.mylyn.tasks.core.AbstractTask;
import org.eclipse.mylyn.tasks.core.ITaskActivityListener;
import org.eclipse.mylyn.tasks.core.ITaskListChangeListener;
+import org.eclipse.mylyn.tasks.core.TaskContainerDelta;
import org.eclipse.mylyn.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
import org.eclipse.swt.SWT;
@@ -86,29 +86,13 @@ public class TaskListFilteredTree extends AbstractMylarFilteredTree {
TasksUiPlugin.getTaskListManager().getTaskList().addChangeListener(new ITaskListChangeListener() {
- public void containerAdded(AbstractTaskContainer container) {
- }
-
- public void containerDeleted(AbstractTaskContainer container) {
- }
-
- public void containerInfoChanged(AbstractTaskContainer container) {
- }
-
- public void localInfoChanged(AbstractTask task) {
- updateTaskProgressBar();
- }
-
- public void repositoryInfoChanged(AbstractTask task) {
- }
-
- public void taskAdded(AbstractTask task) {
- }
-
- public void taskDeleted(AbstractTask task) {
- }
-
- public void taskMoved(AbstractTask task, AbstractTaskContainer fromContainer, AbstractTaskContainer toContainer) {
+ public void containersChanged(Set<TaskContainerDelta> containers) {
+ for (TaskContainerDelta taskContainerDelta : containers) {
+ if (taskContainerDelta.getContainer() instanceof AbstractTask) {
+ updateTaskProgressBar();
+ break;
+ }
+ }
}
});
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListToolTipHandler.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListToolTipHandler.java
index 5f8494e5d..874e9b022 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListToolTipHandler.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListToolTipHandler.java
@@ -28,8 +28,6 @@ import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryQuery;
import org.eclipse.mylyn.tasks.core.AbstractTask;
import org.eclipse.mylyn.tasks.core.AbstractTaskContainer;
-import org.eclipse.mylyn.tasks.core.AbstractTask;
-import org.eclipse.mylyn.tasks.core.AbstractTaskContainer;
import org.eclipse.mylyn.tasks.core.RepositoryStatus;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.core.AbstractTask.RepositoryTaskSyncState;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java
index 0c9a5a873..26771511e 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java
@@ -92,11 +92,10 @@ import org.eclipse.mylyn.tasks.core.AbstractRepositoryQuery;
import org.eclipse.mylyn.tasks.core.AbstractTask;
import org.eclipse.mylyn.tasks.core.AbstractTaskCategory;
import org.eclipse.mylyn.tasks.core.AbstractTaskContainer;
-import org.eclipse.mylyn.tasks.core.AbstractTask;
import org.eclipse.mylyn.tasks.core.ITaskActivityListener;
import org.eclipse.mylyn.tasks.core.ITaskListChangeListener;
-import org.eclipse.mylyn.tasks.core.AbstractTaskContainer;
import org.eclipse.mylyn.tasks.core.TaskCategory;
+import org.eclipse.mylyn.tasks.core.TaskContainerDelta;
import org.eclipse.mylyn.tasks.core.AbstractTask.PriorityLevel;
import org.eclipse.mylyn.tasks.ui.TaskTransfer;
import org.eclipse.mylyn.tasks.ui.TasksUiPlugin;
@@ -192,8 +191,8 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener {
PriorityLevel.P3.toString(), PriorityLevel.P4.toString(), PriorityLevel.P5.toString() };
public static final String[] PRIORITY_LEVEL_DESCRIPTIONS = { PriorityLevel.P1.getDescription(),
- PriorityLevel.P2.getDescription(), PriorityLevel.P3.getDescription(),
- PriorityLevel.P4.getDescription(), PriorityLevel.P5.getDescription() };
+ PriorityLevel.P2.getDescription(), PriorityLevel.P3.getDescription(), PriorityLevel.P4.getDescription(),
+ PriorityLevel.P5.getDescription() };
private static final String PART_NAME = "Task List";
@@ -342,7 +341,8 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener {
private final Listener CATEGORY_GRADIENT_DRAWER = new Listener() {
public void handleEvent(Event event) {
- if (event.item.getData() instanceof AbstractTaskContainer && !(event.item.getData() instanceof AbstractTask)) {
+ if (event.item.getData() instanceof AbstractTaskContainer
+ && !(event.item.getData() instanceof AbstractTask)) {
Scrollable scrollable = (Scrollable) event.widget;
GC gc = event.gc;
@@ -454,99 +454,133 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener {
private final ITaskListChangeListener TASK_REFERESH_LISTENER = new ITaskListChangeListener() {
- public void localInfoChanged(final AbstractTask task) {
+ public void containersChanged(final Set<TaskContainerDelta> containers) {
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
- if (getCurrentPresentation().getPresentationName().equals(
- scheduledPresentation.getPresentationName())) {
+ if (containers == null) {
refresh(null);
- } else {
- refresh(task);
+ return;
}
- }
- });
- if (task.isActive()) {
- String activeTaskLabel = filteredTree.getActiveTaskLabelText();
- if (activeTaskLabel != null && !activeTaskLabel.equals(task.getSummary())) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- filteredTree.indicateActiveTask(task);
+
+ for (TaskContainerDelta taskContainerDelta : containers) {
+ if (taskContainerDelta.getContainer() instanceof AbstractTask) {
+ AbstractTask task = (AbstractTask)taskContainerDelta.getContainer();
+ switch (taskContainerDelta.getKind()) {
+ case ADDED:
+ refresh(null);
+ break;
+ case REMOVED:
+ refresh(null);
+ break;
+ case CHANGED:
+ refresh(task);
+ }
+ } else { // category or query
+ switch (taskContainerDelta.getKind()) {
+ case ADDED:
+ refresh(null);
+ break;
+ case REMOVED:
+ refresh(null);
+ break;
+ case CHANGED:
+ if (getCurrentPresentation().getPresentationName().equals(
+ scheduledPresentation.getPresentationName())) {
+ refresh(null);
+ } else {
+ if (taskContainerDelta.getContainer().equals(TasksUiPlugin.getTaskListManager()
+ .getTaskList()
+ .getAutomaticCategory())) {
+ refresh(null);
+ } else {
+ refresh(taskContainerDelta.getContainer());
+ }
+ }
+ }
}
- });
- }
- }
- }
-
- public void repositoryInfoChanged(AbstractTask task) {
- localInfoChanged(task);
- }
-
- public void taskMoved(final AbstractTask task, final AbstractTaskContainer fromContainer,
- final AbstractTaskContainer toContainer) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- // category might appear or disappear
- refresh(null);
- AbstractTaskContainer rootCategory = TasksUiPlugin.getTaskListManager().getTaskList()
- .getAutomaticCategory();
- if (rootCategory.equals(fromContainer) || rootCategory.equals(toContainer)) {
- refresh(null);
- } else {
- refresh(toContainer);
- refresh(task);
- refresh(fromContainer);
- }
- }
- });
- }
-
- public void taskDeleted(AbstractTask task) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- refresh(null);
- }
- });
- }
-
- public void containerAdded(AbstractTaskContainer container) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- refresh(null);
- }
- });
- }
-
- public void containerDeleted(AbstractTaskContainer container) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- refresh(null);
- }
- });
- }
-
- public void taskAdded(AbstractTask task) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- refresh(null);
- }
- });
- }
-
- public void containerInfoChanged(final AbstractTaskContainer container) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (container == null) {
- // HACK: should be part of policy
- getViewer().refresh(false);
- } else if (container.equals(TasksUiPlugin.getTaskListManager().getTaskList()
- .getAutomaticCategory())) {
- refresh(null);
- } else {
- refresh(container);
}
}
});
}
+
+// public void localInfoChanged(final AbstractTask task) {
+// PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+// public void run() {
+// if (getCurrentPresentation().getPresentationName().equals(
+// scheduledPresentation.getPresentationName())) {
+// refresh(null);
+// } else {
+// refresh(task);
+// }
+// }
+// });
+// if (task.isActive()) {
+// String activeTaskLabel = filteredTree.getActiveTaskLabelText();
+// if (activeTaskLabel != null && !activeTaskLabel.equals(task.getSummary())) {
+// PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+// public void run() {
+// filteredTree.indicateActiveTask(task);
+// }
+// });
+// }
+// }
+// }
+
+// public void repositoryInfoChanged(AbstractTask task) {
+// localInfoChanged(task);
+// }
+
+// public void taskMoved(final AbstractTask task, final AbstractTaskContainer fromContainer,
+// final AbstractTaskContainer toContainer) {
+// PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+// public void run() {
+// // category might appear or disappear
+// refresh(null);
+// AbstractTaskContainer rootCategory = TasksUiPlugin.getTaskListManager()
+// .getTaskList()
+// .getAutomaticCategory();
+// if (rootCategory.equals(fromContainer) || rootCategory.equals(toContainer)) {
+// refresh(null);
+// } else {
+// refresh(toContainer);
+// refresh(task);
+// refresh(fromContainer);
+// }
+// }
+// });
+// }
+
+// public void taskDeleted(AbstractTask task) {
+// PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+// public void run() {
+// refresh(null);
+// }
+// });
+// }
+
+// public void containerAdded(AbstractTaskContainer container) {
+// PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+// public void run() {
+// refresh(null);
+// }
+// });
+// }
+//
+// public void containerDeleted(AbstractTaskContainer container) {
+// PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+// public void run() {
+// refresh(null);
+// }
+// });
+// }
+
+// public void taskAdded(AbstractTask task) {
+// PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+// public void run() {
+// refresh(null);
+// }
+// });
+// }
};
private final IPropertyChangeListener THEME_CHANGE_LISTENER = new IPropertyChangeListener() {
@@ -554,7 +588,8 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener {
if (event.getProperty().equals(IThemeManager.CHANGE_CURRENT_THEME)
|| TaskListColorsAndFonts.isTaskListTheme(event.getProperty())) {
configureGradientColors();
- taskListTableLabelProvider.setCategoryBackgroundColor(themeManager.getCurrentTheme().getColorRegistry()
+ taskListTableLabelProvider.setCategoryBackgroundColor(themeManager.getCurrentTheme()
+ .getColorRegistry()
.get(TaskListColorsAndFonts.THEME_COLOR_TASKLIST_CATEGORY));
getViewer().refresh();
}
@@ -786,8 +821,8 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener {
final IThemeManager themeManager = getSite().getWorkbenchWindow().getWorkbench().getThemeManager();
Color categoryBackground = themeManager.getCurrentTheme().getColorRegistry().get(
TaskListColorsAndFonts.THEME_COLOR_TASKLIST_CATEGORY);
- taskListTableLabelProvider = new TaskTableLabelProvider(new TaskElementLabelProvider(), PlatformUI
- .getWorkbench().getDecoratorManager().getLabelDecorator(), categoryBackground);
+ taskListTableLabelProvider = new TaskTableLabelProvider(new TaskElementLabelProvider(),
+ PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator(), categoryBackground);
getViewer().setLabelProvider(taskListTableLabelProvider);
CellEditor[] editors = new CellEditor[columnNames.length];
@@ -851,7 +886,7 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener {
}
} else if ((e.keyCode & SWT.KEYCODE_BIT) != 0) {
// Do nothing here since it is key code
- } else if (e.keyCode == 'c' && e.stateMask == SWT.MOD1) {
+ } else if (e.keyCode == 'c' && e.stateMask == SWT.MOD1) {
copyDetailsAction.run();
} else if (e.keyCode == SWT.DEL) {
deleteAction.run();
@@ -1259,10 +1294,10 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener {
action.setEnabled(true);
} else if (action instanceof RenameAction) {
if (element instanceof AbstractTaskCategory) {
- AbstractTaskCategory container = (AbstractTaskCategory)element;
+ AbstractTaskCategory container = (AbstractTaskCategory) element;
action.setEnabled(container.isUserDefined());
} else if (element instanceof AbstractRepositoryQuery) {
- action.setEnabled(true);
+ action.setEnabled(true);
}
}
} else {
@@ -1326,15 +1361,14 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener {
}
/**
- * Recursive function that checks for the occurrence of a certain task
- * taskId. All children of the supplied node will be checked.
+ * Recursive function that checks for the occurrence of a certain task taskId. All children of the supplied node
+ * will be checked.
*
* @param task
* The <code>ITask</code> object that is to be searched.
* @param taskId
* The taskId that is being searched for.
- * @return <code>true</code> if the taskId was found in the node or any of
- * its children
+ * @return <code>true</code> if the taskId was found in the node or any of its children
*/
protected boolean lookForId(String taskId) {
return (TasksUiPlugin.getTaskListManager().getTaskList().getTask(taskId) == null);
@@ -1520,8 +1554,7 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener {
isPaused = paused;
IStatusLineManager statusLineManager = getViewSite().getActionBars().getStatusLineManager();
if (isPaused) {
- statusLineManager
- .setMessage(TasksUiImages.getImage(TasksUiImages.TASKLIST), "Mylar context capture paused");
+ statusLineManager.setMessage(TasksUiImages.getImage(TasksUiImages.TASKLIST), "Mylar context capture paused");
setPartName("(paused) " + PART_NAME);
} else {
statusLineManager.setMessage("");
@@ -1598,47 +1631,34 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener {
private void refresh(final AbstractTaskContainer element) {
if (getViewer().getControl() != null && !getViewer().getControl().isDisposed()) {
if (element == null) {
- try {
- // getViewer().getControl().setRedraw(false);
- getViewer().refresh(true);
- } finally {
- // getViewer().getControl().setRedraw(true);
- }
+ getViewer().refresh(true);
} else {
try {
if (element instanceof AbstractTask) {
AbstractTask task = (AbstractTask) element;
- AbstractTaskContainer rootCategory = TasksUiPlugin.getTaskListManager().getTaskList()
- .getAutomaticCategory();
- Set<AbstractRepositoryQuery> queries = TasksUiPlugin.getTaskListManager().getTaskList()
- .getQueriesForHandle(task.getHandleIdentifier());
- if (task.getCategory() == null || task.getCategory().equals(rootCategory)
- || (task instanceof AbstractTask && queries.isEmpty())) {
- // || task.getContainer() instanceof TaskArchive) {
- refresh(null);
- } else {
- getViewer().refresh(task.getCategory(), true);
- // refresh(task.getContainer());
- }
-
-// AbstractQueryHit hit =
-// TasksUiPlugin.getTaskListManager().getTaskList().getQueryHit(
-// task.getHandleIdentifier());
-// if (hit != null) {
-// refresh(hit);
-// }
-// } else if (element instanceof AbstractQueryHit) {
-// AbstractQueryHit hit = (AbstractQueryHit) element;
- queries = TasksUiPlugin.getTaskListManager().getTaskList().getQueriesForHandle(
- task.getHandleIdentifier());
- for (AbstractRepositoryQuery query : queries) {
- refresh(query);
- }
- } else if (element instanceof AbstractTaskContainer) {
- getViewer().refresh(element, true);
+ getViewer().refresh(task, true);
+// AbstractTaskContainer rootCategory = TasksUiPlugin.getTaskListManager()
+// .getTaskList()
+// .getAutomaticCategory();
+// Set<AbstractRepositoryQuery> queries = TasksUiPlugin.getTaskListManager()
+// .getTaskList()
+// .getQueriesForHandle(task.getHandleIdentifier());
+// if (task.getCategory() == null || task.getCategory().equals(rootCategory)
+// || (task instanceof AbstractTask && queries.isEmpty())) {
+// // || task.getContainer() instanceof TaskArchive) {
+// refresh(null);
+// } else {
+// getViewer().refresh(task.getCategory(), true);
+// // refresh(task.getContainer());
+// }
+// queries = TasksUiPlugin.getTaskListManager().getTaskList().getQueriesForHandle(
+// task.getHandleIdentifier());
+// for (AbstractRepositoryQuery query : queries) {
+// refresh(query);
+// }
} else {
getViewer().refresh(element, true);
- }
+ }
} catch (SWTException e) {
MylarStatusHandler.log(e, "Failed to refresh Task List");
}
@@ -1660,8 +1680,9 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener {
public static String getCurrentPriorityLevel() {
if (TasksUiPlugin.getDefault().getPreferenceStore().contains(TasksUiPreferenceConstants.FILTER_PRIORITY)) {
- return TasksUiPlugin.getDefault().getPreferenceStore().getString(
- TasksUiPreferenceConstants.FILTER_PRIORITY);
+ return TasksUiPlugin.getDefault()
+ .getPreferenceStore()
+ .getString(TasksUiPreferenceConstants.FILTER_PRIORITY);
} else {
return PriorityLevel.P5.toString();
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskTableLabelProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskTableLabelProvider.java
index d977c1710..0c27d3280 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskTableLabelProvider.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskTableLabelProvider.java
@@ -23,7 +23,6 @@ import org.eclipse.mylyn.internal.tasks.core.ScheduledTaskContainer;
import org.eclipse.mylyn.internal.tasks.core.TaskArchive;
import org.eclipse.mylyn.internal.tasks.ui.TaskListColorsAndFonts;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.AbstractTaskContainer;
import org.eclipse.mylyn.tasks.core.AbstractTask;
import org.eclipse.mylyn.tasks.core.AbstractTaskContainer;
import org.eclipse.swt.graphics.Color;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingset/TaskElementFactory.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingset/TaskElementFactory.java
index 4ceef99d7..e15656aef 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingset/TaskElementFactory.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingset/TaskElementFactory.java
@@ -10,7 +10,6 @@ package org.eclipse.mylyn.internal.tasks.ui.workingset;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.mylyn.tasks.core.AbstractTaskContainer;
-import org.eclipse.mylyn.tasks.core.AbstractTaskContainer;
import org.eclipse.mylyn.tasks.core.TaskList;
import org.eclipse.mylyn.tasks.ui.TasksUiPlugin;
import org.eclipse.ui.IElementFactory;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingset/TaskWorkingSetUpdater.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingset/TaskWorkingSetUpdater.java
index 506a01ab3..49d699f0a 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingset/TaskWorkingSetUpdater.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingset/TaskWorkingSetUpdater.java
@@ -10,13 +10,15 @@ package org.eclipse.mylyn.internal.tasks.ui.workingset;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.mylyn.tasks.core.AbstractTaskContainer;
import org.eclipse.mylyn.tasks.core.AbstractTask;
-import org.eclipse.mylyn.tasks.core.ITaskListChangeListener;
import org.eclipse.mylyn.tasks.core.AbstractTaskContainer;
+import org.eclipse.mylyn.tasks.core.ITaskListChangeListener;
+import org.eclipse.mylyn.tasks.core.TaskContainerDelta;
import org.eclipse.mylyn.tasks.ui.TasksUiPlugin;
import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.IWorkingSetUpdater;
@@ -72,42 +74,33 @@ public class TaskWorkingSetUpdater implements IWorkingSetUpdater, ITaskListChang
TasksUiPlugin.getTaskListManager().getTaskList().removeChangeListener(this);
}
-
- // ITaskListChangeListener
-
- public void containerAdded(AbstractTaskContainer container) {
- }
-
- public void containerDeleted(AbstractTaskContainer container) {
- synchronized (workingSets) {
- for (IWorkingSet workingSet : workingSets) {
- // TODO could filter by working set id
- ArrayList<IAdaptable> remove = new ArrayList<IAdaptable>();
- for (IAdaptable adaptable : workingSet.getElements()) {
- if (adaptable instanceof AbstractTaskContainer
- && ((AbstractTaskContainer) adaptable).getHandleIdentifier().equals(
- container.getHandleIdentifier())) {
- remove.add(adaptable);
+ public void containersChanged(Set<TaskContainerDelta> containers) {
+ for (TaskContainerDelta taskContainerDelta : containers) {
+ switch (taskContainerDelta.getKind()) {
+ case REMOVED:
+ synchronized (workingSets) {
+ for (IWorkingSet workingSet : workingSets) {
+ // TODO could filter by working set id
+ Set<IAdaptable> remove = new HashSet<IAdaptable>();
+ for (IAdaptable adaptable : workingSet.getElements()) {
+ if (adaptable instanceof AbstractTaskContainer
+ && ((AbstractTaskContainer) adaptable).getHandleIdentifier().equals(
+ taskContainerDelta.getContainer().getHandleIdentifier())) {
+ remove.add(adaptable);
+ }
+ }
+ if(!remove.isEmpty()) {
+ ArrayList<IAdaptable> elements = new ArrayList<IAdaptable>(Arrays.asList(workingSet.getElements()));
+ elements.removeAll(remove);
+ workingSet.setElements(elements.toArray(new IAdaptable[elements.size()]));
+ }
+ }
}
- }
- if(!remove.isEmpty()) {
- ArrayList<IAdaptable> elements = new ArrayList<IAdaptable>(Arrays.asList(workingSet.getElements()));
- elements.removeAll(remove);
- workingSet.setElements(elements.toArray(new IAdaptable[elements.size()]));
- }
+ break;
}
}
}
- public void containerInfoChanged(AbstractTaskContainer container) {
- }
-
- public void localInfoChanged(AbstractTask task) {
- }
-
- public void repositoryInfoChanged(AbstractTask task) {
- }
-
public void taskAdded(AbstractTask task) {
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/AbstractRepositoryConnectorUi.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/AbstractRepositoryConnectorUi.java
index e590aac0c..9a2ebc251 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/AbstractRepositoryConnectorUi.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/AbstractRepositoryConnectorUi.java
@@ -26,7 +26,6 @@ import org.eclipse.mylyn.internal.tasks.ui.wizards.CommonAddExistingTaskWizard;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryQuery;
import org.eclipse.mylyn.tasks.core.AbstractTask;
-import org.eclipse.mylyn.tasks.core.AbstractTask;
import org.eclipse.mylyn.tasks.core.AbstractTaskContainer;
import org.eclipse.mylyn.tasks.core.RepositoryTaskData;
import org.eclipse.mylyn.tasks.core.TaskRepository;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/RepositorySynchronizationManager.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/RepositorySynchronizationManager.java
index 8c875a1e8..abf321820 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/RepositorySynchronizationManager.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/RepositorySynchronizationManager.java
@@ -220,7 +220,7 @@ public class RepositorySynchronizationManager {
repositoryTask.setSyncState(RepositoryTaskSyncState.OUTGOING);
TasksUiPlugin.getDefault().getTaskDataManager().saveEdits(repositoryTask.getHandleIdentifier(),
Collections.unmodifiableSet(modifiedAttributes));
- TasksUiPlugin.getTaskListManager().getTaskList().notifyLocalInfoChanged(repositoryTask);
+ TasksUiPlugin.getTaskListManager().getTaskList().notifyTaskChanged(repositoryTask);
}
/**
@@ -335,13 +335,13 @@ public class RepositorySynchronizationManager {
dataManager.setOldTaskData(repositoryTask.getHandleIdentifier(), taskData);
}
repositoryTask.setSyncState(RepositoryTaskSyncState.SYNCHRONIZED);
- TasksUiPlugin.getTaskListManager().getTaskList().notifyLocalInfoChanged(repositoryTask);
+ TasksUiPlugin.getTaskListManager().getTaskList().notifyTaskChanged(repositoryTask);
} else if (read && repositoryTask.getSyncState().equals(RepositoryTaskSyncState.CONFLICT)) {
if (taskData != null && taskData.getLastModified() != null) {
repositoryTask.setLastSyncDateStamp(taskData.getLastModified());
}
repositoryTask.setSyncState(RepositoryTaskSyncState.OUTGOING);
- TasksUiPlugin.getTaskListManager().getTaskList().notifyLocalInfoChanged(repositoryTask);
+ TasksUiPlugin.getTaskListManager().getTaskList().notifyTaskChanged(repositoryTask);
} else if (read && repositoryTask.getSyncState().equals(RepositoryTaskSyncState.SYNCHRONIZED)) {
if (taskData != null && taskData.getLastModified() != null) {
repositoryTask.setLastSyncDateStamp(taskData.getLastModified());
@@ -358,7 +358,7 @@ public class RepositorySynchronizationManager {
}
} else if (!read && repositoryTask.getSyncState().equals(RepositoryTaskSyncState.SYNCHRONIZED)) {
repositoryTask.setSyncState(RepositoryTaskSyncState.INCOMING);
- TasksUiPlugin.getTaskListManager().getTaskList().notifyLocalInfoChanged(repositoryTask);
+ TasksUiPlugin.getTaskListManager().getTaskList().notifyTaskChanged(repositoryTask);
}
}
@@ -366,7 +366,8 @@ public class RepositorySynchronizationManager {
TaskDataManager dataManager = TasksUiPlugin.getDefault().getTaskDataManager();
dataManager.discardEdits(repositoryTask.getHandleIdentifier());
repositoryTask.setSyncState(RepositoryTaskSyncState.SYNCHRONIZED);
- TasksUiPlugin.getTaskListManager().getTaskList().notifyRepositoryInfoChanged(repositoryTask);
+
+ TasksUiPlugin.getTaskListManager().getTaskList().notifyTaskChanged(repositoryTask);
}
/**
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/SynchronizeQueryJob.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/SynchronizeQueryJob.java
index e3c3754fd..79a3e580f 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/SynchronizeQueryJob.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/SynchronizeQueryJob.java
@@ -91,8 +91,9 @@ class SynchronizeQueryJob extends Job {
protected IStatus run(IProgressMonitor monitor) {
monitor.beginTask(JOB_LABEL, queries.size());
+ taskList.notifyContainersUpdated(queries);
for (AbstractRepositoryQuery repositoryQuery : queries) {
- taskList.notifyContainerUpdated(repositoryQuery);
+// taskList.notifyContainerUpdated(repositoryQuery);
repositoryQuery.setStatus(null);
monitor.setTaskName("Synchronizing: " + repositoryQuery.getSummary());
@@ -142,8 +143,8 @@ class SynchronizeQueryJob extends Job {
}
repositoryQuery.setCurrentlySynchronizing(false);
-
- taskList.notifyContainerUpdated(repositoryQuery);
+ taskList.notifyContainersUpdated(queries);
+// taskList.notifyContainerUpdated(repositoryQuery);
}
for (TaskRepository repository : repositories) {
@@ -152,7 +153,7 @@ class SynchronizeQueryJob extends Job {
// HACK: force entire Task List to refresh in case containers need to
// appear or disappear
- taskList.notifyContainerUpdated(null);
+ taskList.notifyContainersUpdated(null);
monitor.done();
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/SynchronizeTaskJob.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/SynchronizeTaskJob.java
index 78c8fca64..abcecb8f1 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/SynchronizeTaskJob.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/SynchronizeTaskJob.java
@@ -100,7 +100,7 @@ class SynchronizeTaskJob extends Job {
// TODO: Set in connector.updateTask
repositoryTask.setCurrentlySynchronizing(false);
- TasksUiPlugin.getTaskListManager().getTaskList().notifyLocalInfoChanged(repositoryTask);
+ TasksUiPlugin.getTaskListManager().getTaskList().notifyTaskChanged(repositoryTask);
// TasksUiPlugin.getTaskListManager().getTaskList().notifyRepositoryInfoChanged(repositoryTask);
monitor.worked(1);
@@ -128,7 +128,7 @@ class SynchronizeTaskJob extends Job {
null));
}
- TasksUiPlugin.getTaskListManager().getTaskList().notifyLocalInfoChanged(repositoryTask);
+ TasksUiPlugin.getTaskListManager().getTaskList().notifyTaskChanged(repositoryTask);
ITaskDataHandler taskDataHandler = connector.getTaskDataHandler();
if (taskDataHandler != null) {
String taskId = repositoryTask.getTaskId();
@@ -168,7 +168,7 @@ class SynchronizeTaskJob extends Job {
if (repositoryTask.getSyncState() == RepositoryTaskSyncState.INCOMING
|| repositoryTask.getSyncState() == RepositoryTaskSyncState.CONFLICT) {
- TasksUiPlugin.getTaskListManager().getTaskList().notifyRepositoryInfoChanged(repositoryTask);
+ TasksUiPlugin.getTaskListManager().getTaskList().notifyTaskChanged(repositoryTask);
}
} else {
connector.updateTaskFromRepository(repository, repositoryTask, monitor);
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskListManager.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskListManager.java
index 3061c701d..2d34469f5 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskListManager.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskListManager.java
@@ -38,11 +38,11 @@ import org.eclipse.mylyn.context.core.IInteractionContextListener;
import org.eclipse.mylyn.context.core.IInteractionElement;
import org.eclipse.mylyn.core.MylarStatusHandler;
import org.eclipse.mylyn.internal.context.core.InteractionContextManager;
-import org.eclipse.mylyn.internal.tasks.core.ScheduledTaskDelegate;
-import org.eclipse.mylyn.internal.tasks.core.ScheduledTaskContainer;
import org.eclipse.mylyn.internal.tasks.core.LocalRepositoryConnector;
import org.eclipse.mylyn.internal.tasks.core.LocalTask;
import org.eclipse.mylyn.internal.tasks.core.RepositoryTaskHandleUtil;
+import org.eclipse.mylyn.internal.tasks.core.ScheduledTaskContainer;
+import org.eclipse.mylyn.internal.tasks.core.ScheduledTaskDelegate;
import org.eclipse.mylyn.internal.tasks.core.TaskDataManager;
import org.eclipse.mylyn.internal.tasks.core.WebTask;
import org.eclipse.mylyn.internal.tasks.ui.ITasksUiConstants;
@@ -55,13 +55,12 @@ import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
import org.eclipse.mylyn.monitor.core.InteractionEvent;
import org.eclipse.mylyn.tasks.core.AbstractTask;
import org.eclipse.mylyn.tasks.core.AbstractTaskContainer;
-import org.eclipse.mylyn.tasks.core.AbstractTask;
import org.eclipse.mylyn.tasks.core.ITaskActivityListener;
import org.eclipse.mylyn.tasks.core.ITaskListChangeListener;
-import org.eclipse.mylyn.tasks.core.AbstractTaskContainer;
import org.eclipse.mylyn.tasks.core.RepositoryTaskAttribute;
import org.eclipse.mylyn.tasks.core.RepositoryTaskData;
import org.eclipse.mylyn.tasks.core.TaskCategory;
+import org.eclipse.mylyn.tasks.core.TaskContainerDelta;
import org.eclipse.mylyn.tasks.core.TaskList;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.core.AbstractTask.PriorityLevel;
@@ -209,31 +208,17 @@ public class TaskListManager implements IPropertyChangeListener {
private final ITaskListChangeListener CHANGE_LISTENER = new ITaskListChangeListener() {
- public void containerAdded(AbstractTaskContainer container) {
- }
-
- public void containerDeleted(AbstractTaskContainer container) {
- }
-
- public void containerInfoChanged(AbstractTaskContainer container) {
- }
-
- public void localInfoChanged(AbstractTask task) {
- }
-
- public void repositoryInfoChanged(AbstractTask task) {
- }
-
- public void taskAdded(AbstractTask task) {
- }
-
- public void taskDeleted(AbstractTask task) {
- TaskListManager.this.resetAndRollOver();
- }
-
- public void taskMoved(AbstractTask task, AbstractTaskContainer fromContainer, AbstractTaskContainer toContainer) {
+ public void containersChanged(Set<TaskContainerDelta> containers) {
+ for (TaskContainerDelta taskContainerDelta : containers) {
+ if (taskContainerDelta.getContainer() instanceof AbstractTask) {
+ switch(taskContainerDelta.getKind()) {
+ case REMOVED:
+ TaskListManager.this.resetAndRollOver();
+ return;
+ }
+ }
+ }
}
-
};
private int timeTicks = 0;
@@ -1036,7 +1021,7 @@ public class TaskListManager implements IPropertyChangeListener {
tasksWithReminders.add(task);
}
parseFutureReminders();
- taskList.notifyLocalInfoChanged(task);
+ taskList.notifyTaskChanged(task);
}
public void setDueDate(AbstractTask task, Date dueDate) {
@@ -1048,7 +1033,7 @@ public class TaskListManager implements IPropertyChangeListener {
tasksWithDueDates.add(task);
}
parseFutureReminders();
- taskList.notifyLocalInfoChanged(task);
+ taskList.notifyTaskChanged(task);
}
/**
@@ -1191,8 +1176,9 @@ public class TaskListManager implements IPropertyChangeListener {
taskList.addTask(newTask, (TaskCategory) selectedObject);
} else if (selectedObject instanceof AbstractTask) {
AbstractTask task = (AbstractTask) selectedObject;
- if (task.getCategory() instanceof TaskCategory) {
- taskList.addTask(newTask, task.getCategory());
+ AbstractTaskContainer container = task.getParentContainers().iterator().next();
+ if (container instanceof TaskCategory) {
+ taskList.addTask(newTask, container);
} else if (view != null && view.getDrilledIntoCategory() instanceof TaskCategory) {
taskList.addTask(newTask, view.getDrilledIntoCategory());
} else {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiUtil.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiUtil.java
index ed7913beb..4a2fc149a 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiUtil.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiUtil.java
@@ -38,8 +38,8 @@ import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.window.Window;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.mylyn.core.MylarStatusHandler;
-import org.eclipse.mylyn.internal.tasks.core.ScheduledTaskDelegate;
import org.eclipse.mylyn.internal.tasks.core.LocalTask;
+import org.eclipse.mylyn.internal.tasks.core.ScheduledTaskDelegate;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPreferenceConstants;
import org.eclipse.mylyn.internal.tasks.ui.editors.CategoryEditor;
import org.eclipse.mylyn.internal.tasks.ui.editors.CategoryEditorInput;
@@ -49,8 +49,6 @@ import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryQuery;
import org.eclipse.mylyn.tasks.core.AbstractTask;
import org.eclipse.mylyn.tasks.core.AbstractTaskContainer;
-import org.eclipse.mylyn.tasks.core.AbstractTask;
-import org.eclipse.mylyn.tasks.core.AbstractTaskContainer;
import org.eclipse.mylyn.tasks.core.RepositoryTaskData;
import org.eclipse.mylyn.tasks.core.TaskCategory;
import org.eclipse.mylyn.tasks.core.TaskRepository;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditor.java
index 5010a7ad0..cb704dc3e 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditor.java
@@ -80,7 +80,6 @@ import org.eclipse.mylyn.monitor.core.DateUtil;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.AbstractTask;
import org.eclipse.mylyn.tasks.core.AbstractTaskCategory;
-import org.eclipse.mylyn.tasks.core.AbstractTaskContainer;
import org.eclipse.mylyn.tasks.core.ITaskDataHandler;
import org.eclipse.mylyn.tasks.core.ITaskListChangeListener;
import org.eclipse.mylyn.tasks.core.RepositoryAttachment;
@@ -89,6 +88,7 @@ import org.eclipse.mylyn.tasks.core.RepositoryStatus;
import org.eclipse.mylyn.tasks.core.RepositoryTaskAttribute;
import org.eclipse.mylyn.tasks.core.RepositoryTaskData;
import org.eclipse.mylyn.tasks.core.TaskComment;
+import org.eclipse.mylyn.tasks.core.TaskContainerDelta;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.core.AbstractTask.RepositoryTaskSyncState;
import org.eclipse.mylyn.tasks.ui.TasksUiPlugin;
@@ -286,27 +286,20 @@ public abstract class AbstractTaskEditor extends TaskFormPage {
}
};
- private final ITaskListChangeListener TASKLIST_CHANGE_LISTENER = new ITaskListChangeListener() {
-
- public void containerAdded(AbstractTaskContainer container) {
- }
-
- public void containerDeleted(AbstractTaskContainer container) {
- }
-
- public void containerInfoChanged(AbstractTaskContainer container) {
- }
- public void localInfoChanged(AbstractTask task) {
- }
-
- public void repositoryInfoChanged(final AbstractTask task) {
-
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
-
- public void run() {
+ private final ITaskListChangeListener TASKLIST_CHANGE_LISTENER = new ITaskListChangeListener() {
- if (repositoryTask != null && task.equals(repositoryTask)) {
+ public void containersChanged(Set<TaskContainerDelta> containers) {
+ AbstractTask task = null;
+ for (TaskContainerDelta taskContainerDelta : containers) {
+ if (repositoryTask != null && repositoryTask.equals(taskContainerDelta.getContainer())) {
+ task = (AbstractTask)taskContainerDelta.getContainer();
+ break;
+ }
+ }
+ if (task != null) {
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+ public void run() {
if (repositoryTask.getSyncState() == RepositoryTaskSyncState.INCOMING
|| repositoryTask.getSyncState() == RepositoryTaskSyncState.CONFLICT) {
// MessageDialog.openInformation(AbstractTaskEditor.this.getSite().getShell(),
@@ -326,20 +319,11 @@ public abstract class AbstractTaskEditor extends TaskFormPage {
refreshEditor();
}
}
- }
- });
-
- }
-
- public void taskAdded(AbstractTask task) {
- }
-
- public void taskDeleted(AbstractTask task) {
- }
-
- public void taskMoved(AbstractTask task, AbstractTaskContainer fromContainer, AbstractTaskContainer toContainer) {
+ });
+ }
}
};
+
private List<ISelectionChangedListener> selectionChangedListeners = new ArrayList<ISelectionChangedListener>();
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/RepositoryTaskEditorDropListener.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/RepositoryTaskEditorDropListener.java
index fc831d78e..49f6cff8c 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/RepositoryTaskEditorDropListener.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/RepositoryTaskEditorDropListener.java
@@ -14,7 +14,6 @@ import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.mylyn.internal.tasks.ui.wizards.NewAttachmentWizard;
import org.eclipse.mylyn.internal.tasks.ui.wizards.NewAttachmentWizardDialog;
import org.eclipse.mylyn.tasks.core.AbstractTask;
-import org.eclipse.mylyn.tasks.core.AbstractTask;
import org.eclipse.mylyn.tasks.ui.TasksUiPlugin;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.DropTargetEvent;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java
index db60cf619..7c5240a8b 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java
@@ -23,12 +23,11 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.mylyn.core.MylarStatusHandler;
import org.eclipse.mylyn.internal.tasks.core.LocalTask;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPreferenceConstants;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiImages;
+import org.eclipse.mylyn.internal.tasks.ui.TasksUiPreferenceConstants;
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorActionContributor;
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskPlanningEditor;
import org.eclipse.mylyn.tasks.core.AbstractTask;
-import org.eclipse.mylyn.tasks.core.AbstractTask;
import org.eclipse.mylyn.tasks.core.RepositoryTaskData;
import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
import org.eclipse.mylyn.tasks.ui.TasksUiPlugin;
@@ -234,7 +233,7 @@ public class TaskEditor extends SharedHeaderFormEditor implements IBusyEditor {
public void notifyTaskChanged() {
if (task != null) {
- TasksUiPlugin.getTaskListManager().getTaskList().notifyLocalInfoChanged(task);
+ TasksUiPlugin.getTaskListManager().getTaskList().notifyTaskChanged(task);
}
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditorInput.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditorInput.java
index 4731d5f40..5400405b8 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditorInput.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditorInput.java
@@ -16,7 +16,6 @@ package org.eclipse.mylyn.tasks.ui.editors;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorInputFactory;
import org.eclipse.mylyn.tasks.core.AbstractTask;
-import org.eclipse.mylyn.tasks.core.AbstractTask;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IPersistableElement;
diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracTaskDataHandler.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracTaskDataHandler.java
index 3bb54b048..f412e85fc 100644
--- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracTaskDataHandler.java
+++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracTaskDataHandler.java
@@ -31,7 +31,6 @@ import org.eclipse.mylyn.internal.trac.core.model.TracTicketField;
import org.eclipse.mylyn.internal.trac.core.model.TracTicket.Key;
import org.eclipse.mylyn.internal.trac.core.util.TracUtils;
import org.eclipse.mylyn.tasks.core.AbstractAttributeFactory;
-import org.eclipse.mylyn.tasks.core.AbstractTask;
import org.eclipse.mylyn.tasks.core.ITaskDataHandler;
import org.eclipse.mylyn.tasks.core.RepositoryAttachment;
import org.eclipse.mylyn.tasks.core.RepositoryOperation;
diff --git a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracRepositoryConnectorTest.java b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracRepositoryConnectorTest.java
index 8e04b1a88..00cf18b9e 100644
--- a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracRepositoryConnectorTest.java
+++ b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracRepositoryConnectorTest.java
@@ -43,7 +43,6 @@ import org.eclipse.mylyn.internal.trac.core.model.TracTicket.Key;
import org.eclipse.mylyn.internal.trac.ui.wizard.TracRepositorySettingsPage;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.AbstractTask;
-import org.eclipse.mylyn.tasks.core.AbstractTask;
import org.eclipse.mylyn.tasks.core.QueryHitCollector;
import org.eclipse.mylyn.tasks.core.RepositoryTaskData;
import org.eclipse.mylyn.tasks.core.TaskRepository;

Back to the top