diff options
Diffstat (limited to 'org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/DownloadAttachmentJob.java')
-rw-r--r-- | org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/DownloadAttachmentJob.java | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/DownloadAttachmentJob.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/DownloadAttachmentJob.java deleted file mode 100644 index a1347c4b4..000000000 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/DownloadAttachmentJob.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.internal.tasks.ui.util; - -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin; -import org.eclipse.mylyn.tasks.core.ITaskAttachment; -import org.eclipse.mylyn.tasks.core.RepositoryStatus; - -/** - * @author Steffen Pingel - */ -public class DownloadAttachmentJob extends Job { - - private final ITaskAttachment attachment; - - private final File targetFile; - - public DownloadAttachmentJob(ITaskAttachment attachment, File targetFile) { - super(Messages.DownloadAttachmentJob_Downloading_Attachment); - this.attachment = attachment; - this.targetFile = targetFile; - } - - @Override - protected IStatus run(IProgressMonitor monitor) { - try { - try { - OutputStream out = new BufferedOutputStream(new FileOutputStream(targetFile)); - try { - AttachmentUtil.downloadAttachment(attachment, out, monitor); - } finally { - out.close(); - } - } catch (IOException e) { - throw new CoreException(new RepositoryStatus(attachment.getTaskRepository(), IStatus.ERROR, - TasksUiPlugin.ID_PLUGIN, RepositoryStatus.ERROR_IO, "IO error writing attachment: " //$NON-NLS-1$ - + e.getMessage(), e)); - } - } catch (final CoreException e) { - TasksUiInternal.asyncDisplayStatus(Messages.DownloadAttachmentJob_Copy_Attachment_to_Clipboard, - e.getStatus()); - return Status.OK_STATUS; - } - - return Status.OK_STATUS; - } - -} |