Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Muskalla2012-11-12 15:57:11 -0500
committerSteffen Pingel2012-11-13 05:48:51 -0500
commit6d030db9f368c33e3dcc5182bacb9f42b62d97e8 (patch)
treeb0e9282b7bf6202616e874fac20cfbf86e7c86aa /org.eclipse.mylyn.trac.core
parent107375ddaf942a0500a8e68b60a0dccd88ae975a (diff)
downloadorg.eclipse.mylyn.tasks-6d030db9f368c33e3dcc5182bacb9f42b62d97e8.tar.gz
org.eclipse.mylyn.tasks-6d030db9f368c33e3dcc5182bacb9f42b62d97e8.tar.xz
org.eclipse.mylyn.tasks-6d030db9f368c33e3dcc5182bacb9f42b62d97e8.zip
Implement deleteTask API for Trac
For API consumers, it is helpful to have an API to delete exisiting tasks (eg. for cleanup). Given Mylyn already provides the API, this change simply implements this behavior for Trac Change-Id: I262b2910c8ecd8ffcd835c4531c06663c5c0f7e2
Diffstat (limited to 'org.eclipse.mylyn.trac.core')
-rw-r--r--org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryConnector.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryConnector.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryConnector.java
index 09b735f5b..a8c3b3e50 100644
--- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryConnector.java
+++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryConnector.java
@@ -7,6 +7,7 @@
*
* Contributors:
* Steffen Pingel - initial API and implementation
+ * Benjamin Muskalla (Tasktop Technologies) - support for deleting tasks
*******************************************************************************/
package org.eclipse.mylyn.internal.trac.core;
@@ -35,6 +36,7 @@ import org.eclipse.mylyn.internal.trac.core.client.AbstractWikiHandler;
import org.eclipse.mylyn.internal.trac.core.client.ITracClient;
import org.eclipse.mylyn.internal.trac.core.client.ITracClient.Version;
import org.eclipse.mylyn.internal.trac.core.client.ITracWikiClient;
+import org.eclipse.mylyn.internal.trac.core.client.TracException;
import org.eclipse.mylyn.internal.trac.core.model.TracComment;
import org.eclipse.mylyn.internal.trac.core.model.TracPriority;
import org.eclipse.mylyn.internal.trac.core.model.TracSearch;
@@ -58,6 +60,7 @@ import org.eclipse.mylyn.tasks.core.sync.ISynchronizationSession;
/**
* @author Steffen Pingel
+ * @author Benjamin Muskalla
*/
public class TracRepositoryConnector extends AbstractRepositoryConnector {
@@ -751,4 +754,21 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector {
throw new CoreException(TracCorePlugin.toStatus(e, repository));
}
}
+
+ @Override
+ public boolean canDeleteTask(TaskRepository repository, ITask task) {
+ return hasRichEditor(repository);
+ }
+
+ @Override
+ public IStatus deleteTask(TaskRepository repository, ITask task, IProgressMonitor monitor) throws CoreException {
+ monitor = Policy.monitorFor(monitor);
+ ITracClient client = getClientManager().getTracClient(repository);
+ try {
+ client.deleteTicket(getTicketId(task.getTaskId()), monitor);
+ } catch (TracException e) {
+ throw new CoreException(TracCorePlugin.toStatus(e, repository));
+ }
+ return Status.OK_STATUS;
+ }
}

Back to the top