Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/DownloadAndOpenTaskAttachmentJob.java9
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskAttachmentEditorViewer.java22
2 files changed, 6 insertions, 25 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/DownloadAndOpenTaskAttachmentJob.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/DownloadAndOpenTaskAttachmentJob.java
index e29515b28..59fa8575c 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/DownloadAndOpenTaskAttachmentJob.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/DownloadAndOpenTaskAttachmentJob.java
@@ -14,7 +14,6 @@ package org.eclipse.mylyn.internal.tasks.ui;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
import java.text.MessageFormat;
import java.util.concurrent.atomic.AtomicReference;
@@ -24,7 +23,7 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.mylyn.internal.provisional.commons.ui.ICoreRunnable;
import org.eclipse.mylyn.internal.tasks.ui.util.AttachmentUtil;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.ITaskAttachment;
@@ -38,7 +37,7 @@ import org.eclipse.ui.PartInitException;
/**
* @author Peter Stibrany
*/
-class DownloadAndOpenTaskAttachmentJob implements IRunnableWithProgress {
+class DownloadAndOpenTaskAttachmentJob implements ICoreRunnable {
private final ITaskAttachment attachment;
private final IWorkbenchPage page;
@@ -54,11 +53,11 @@ class DownloadAndOpenTaskAttachmentJob implements IRunnableWithProgress {
this.editorID = editorID;
}
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ public void run(IProgressMonitor monitor) throws CoreException {
monitor.beginTask(jobName, IProgressMonitor.UNKNOWN);
IStatus result = execute(new SubProgressMonitor(monitor, 100));
if (result != null && !result.isOK()) {
- throw new InvocationTargetException(new CoreException(result));
+ throw new CoreException(result);
}
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskAttachmentEditorViewer.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskAttachmentEditorViewer.java
index 76c94ff87..09fcefef4 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskAttachmentEditorViewer.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskAttachmentEditorViewer.java
@@ -11,18 +11,14 @@
package org.eclipse.mylyn.internal.tasks.ui;
-import java.lang.reflect.InvocationTargetException;
import java.text.MessageFormat;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.mylyn.commons.core.StatusHandler;
+import org.eclipse.mylyn.internal.provisional.commons.ui.CommonUiUtil;
import org.eclipse.mylyn.internal.tasks.ui.util.AttachmentUtil;
import org.eclipse.mylyn.tasks.core.ITaskAttachment;
import org.eclipse.ui.IEditorDescriptor;
import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.progress.IProgressService;
/**
* @author Peter Stibrany
@@ -48,20 +44,6 @@ public class TaskAttachmentEditorViewer implements ITaskAttachmentViewer {
DownloadAndOpenTaskAttachmentJob job = new DownloadAndOpenTaskAttachmentJob(
MessageFormat.format(Messages.TaskAttachmentEditorViewer_openingAttachment,
AttachmentUtil.getAttachmentFilename(attachment)), attachment, page, descriptor.getId());
-
- IProgressService service = page.getWorkbenchWindow().getWorkbench().getProgressService();
- try {
- service.run(true, true, job);
- } catch (InvocationTargetException e) {
- if (e.getTargetException() instanceof CoreException) {
- StatusHandler.log(((CoreException) e.getTargetException()).getStatus());
- } else {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- Messages.TaskAttachmentEditorViewer_ErrorDownloadingAttachment, e));
- }
-
- } catch (InterruptedException e) {
- // ignore, since it was canceled
- }
+ CommonUiUtil.runInUi(job, null);
}
}

Back to the top