Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrelves2008-09-03 16:20:23 -0400
committerrelves2008-09-03 16:20:23 -0400
commitec39d0a804e9187c0d90fdf2ba88f021a9f7825b (patch)
treeae6e1b311cfd3597f25b4b3cf6a964389314c890
parent95e4baa7274886f57b9e47f2a125c6b666e65511 (diff)
downloadorg.eclipse.mylyn.tasks-ec39d0a804e9187c0d90fdf2ba88f021a9f7825b.tar.gz
org.eclipse.mylyn.tasks-ec39d0a804e9187c0d90fdf2ba88f021a9f7825b.tar.xz
org.eclipse.mylyn.tasks-ec39d0a804e9187c0d90fdf2ba88f021a9f7825b.zip
NEW - bug 223086: [patch] allow to remove all tasks from unmatched container
https://bugs.eclipse.org/bugs/show_bug.cgi?id=223086
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/DeleteAction.java24
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java2
2 files changed, 23 insertions, 3 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/DeleteAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/DeleteAction.java
index e7a27c531..38e68af36 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/DeleteAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/DeleteAction.java
@@ -8,6 +8,7 @@
package org.eclipse.mylyn.internal.tasks.ui.actions;
+import java.util.Collection;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
@@ -20,9 +21,11 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.context.core.ContextCore;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
+import org.eclipse.mylyn.internal.tasks.core.AutomaticRepositoryTaskContainer;
import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
import org.eclipse.mylyn.internal.tasks.core.TaskCategory;
import org.eclipse.mylyn.internal.tasks.core.UnmatchedTaskContainer;
+import org.eclipse.mylyn.internal.tasks.core.UnsubmittedTaskContainer;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
@@ -90,6 +93,11 @@ public class DeleteAction extends Action {
message = "Permanently delete the category? Local tasks will be moved to the Uncategorized folder. Repository tasks will be moved to the Unmatched folder.";
} else if (object instanceof IRepositoryQuery) {
message = "Permanently delete the query? Contained tasks will be moved to the Unmatched folder.";
+ } else if (object instanceof UnmatchedTaskContainer) {
+ message = "Delete the planning information and context of all unmatched tasks? The server"
+ + " copy of these tasks will not be deleted and the task will remain in queries that match it.";
+ } else if (object instanceof UnsubmittedTaskContainer) {
+ message = "Delete all of the unsubmitted tasks?";
} else {
message = "Permanently delete the element listed below?";
}
@@ -107,6 +115,10 @@ public class DeleteAction extends Action {
return;
}
+ performDeletion(toDelete);
+ }
+
+ protected void performDeletion(Collection<?> toDelete) {
for (Object selectedObject : toDelete) {
if (selectedObject instanceof ITask) {
AbstractTask task = null;
@@ -143,8 +155,16 @@ public class DeleteAction extends Action {
TasksUiInternal.closeEditorInActivePage(task, false);
}
TasksUiInternal.getTaskList().deleteCategory(cat);
- } else if (selectedObject instanceof UnmatchedTaskContainer) {
- // ignore
+ } else if (selectedObject instanceof AutomaticRepositoryTaskContainer) {
+ // support both the unmatched and the unsubmitted
+
+ if (toDelete.size() == 1) {
+
+ // loop to ensure that all subtasks are deleted as well
+ while (((AutomaticRepositoryTaskContainer) selectedObject).getChildren().size() != 0) {
+ performDeletion(((AutomaticRepositoryTaskContainer) selectedObject).getChildren());
+ }
+ }
} else {
MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
"Delete failed", "Nothing selected.");
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 0c6cd4497..f88a7cd0a 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
@@ -1405,7 +1405,7 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener {
} else if (action instanceof MarkTaskIncompleteAction) {
action.setEnabled(false);
} else if (action instanceof DeleteAction) {
- if (element instanceof UncategorizedTaskContainer || element instanceof UnmatchedTaskContainer) {
+ if (element instanceof UncategorizedTaskContainer) {
action.setEnabled(false);
} else {
action.setEnabled(true);

Back to the top