Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2010-05-25 18:03:17 -0400
committerspingel2010-05-25 18:03:17 -0400
commite2100aad0f0a594d36dbbf3cb515079c7d4a3ffa (patch)
tree9f48e6fe35995b6aeb63ab9f0b6404165c9fd13d /org.eclipse.mylyn.tasks.ui
parent9fe99bd2583b510bba69e88468912254ecdb0ba4 (diff)
downloadorg.eclipse.mylyn.tasks-e2100aad0f0a594d36dbbf3cb515079c7d4a3ffa.tar.gz
org.eclipse.mylyn.tasks-e2100aad0f0a594d36dbbf3cb515079c7d4a3ffa.tar.xz
org.eclipse.mylyn.tasks-e2100aad0f0a594d36dbbf3cb515079c7d4a3ffa.zip
NEW - bug 308499: [api] add hook so that connectors can participate in task migration upon submission
https://bugs.eclipse.org/bugs/show_bug.cgi?id=308499
Diffstat (limited to 'org.eclipse.mylyn.tasks.ui')
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskMigrator.java21
1 files changed, 21 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskMigrator.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskMigrator.java
index e407e74a9..41f0e5af0 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskMigrator.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskMigrator.java
@@ -15,8 +15,10 @@ import java.lang.reflect.InvocationTargetException;
import java.util.Date;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.core.runtime.Status;
import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.context.core.ContextCore;
@@ -26,7 +28,9 @@ import org.eclipse.mylyn.internal.tasks.core.DateRange;
import org.eclipse.mylyn.internal.tasks.ui.ChangeActivityHandleOperation;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
+import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.ITask;
+import org.eclipse.mylyn.tasks.core.TaskMigrationEvent;
import org.eclipse.mylyn.tasks.ui.TasksUi;
import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
@@ -85,6 +89,23 @@ public class TaskMigrator {
public void execute(ITask newTask) {
copyProperties(newTask);
+ // invoke participants
+ final AbstractRepositoryConnector connector = TasksUi.getRepositoryConnector(newTask.getConnectorKind());
+ if (connector != null) {
+ final TaskMigrationEvent event = new TaskMigrationEvent(oldTask, newTask);
+ SafeRunner.run(new ISafeRunnable() {
+ public void handleException(Throwable e) {
+ StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
+ "Unexpected error in task migrator: " //$NON-NLS-1$
+ + connector.getClass(), e));
+ }
+
+ public void run() throws Exception {
+ connector.migrateTask(event);
+ }
+ });
+ }
+
try {
// temporarily disable auto editor management
active = true;

Back to the top