Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrelves2006-12-07 16:13:05 -0500
committerrelves2006-12-07 16:13:05 -0500
commitc068421afba79b223a93abde79f4be03c7a1b447 (patch)
treef5b29c704fec09d648116ce5aa49d95a863cd681
parent7be8bab690f52d934cd9bc027c5445ce5b17b6f2 (diff)
downloadorg.eclipse.mylyn.tasks-c068421afba79b223a93abde79f4be03c7a1b447.tar.gz
org.eclipse.mylyn.tasks-c068421afba79b223a93abde79f4be03c7a1b447.tar.xz
org.eclipse.mylyn.tasks-c068421afba79b223a93abde79f4be03c7a1b447.zip
RESOLVED - bug 166615: Add attachment from clipboard don't work in Bugzilla task editor
https://bugs.eclipse.org/bugs/show_bug.cgi?id=166615
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewAttachmentWizard.java30
1 files changed, 20 insertions, 10 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewAttachmentWizard.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewAttachmentWizard.java
index 26be4eff7..fa61fffb8 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewAttachmentWizard.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewAttachmentWizard.java
@@ -107,19 +107,27 @@ public class NewAttachmentWizard extends Wizard {
if (contents == null) {
// TODO Handle error
}
-
- File file = new File(TasksUiPlugin.getDefault().getDataDirectory()
- + System.getProperty("file.separator").charAt(0) + "Clipboard-attachment");
+ // File file = new
+ // File(TasksUiPlugin.getDefault().getDefaultDataDirectory()
+ // + System.getProperty("file.separator").charAt(0) +
+ // "Clipboard-attachment");
+ File file = null;
try {
+ file = File.createTempFile("clipboard", ".txt");
FileWriter writer = new FileWriter(file);
writer.write(contents);
writer.flush();
writer.close();
} catch (IOException e) {
// TODO Handle error
+ return false;
+ }
+ if (file != null) {
+ path = file.getAbsolutePath();
+ attachment.setDeleteAfterUpload(true);
+ } else {
+ return false;
}
- path = file.getAbsolutePath();
- attachment.setDeleteAfterUpload(true);
}
attachment.setFilePath(path);
@@ -143,8 +151,8 @@ public class NewAttachmentWizard extends Wizard {
Job submitJob = new Job("Submitting attachment") {
@Override
protected IStatus run(IProgressMonitor monitor) {
- AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager()
- .getRepositoryConnector(repository.getKind());
+ AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager().getRepositoryConnector(
+ repository.getKind());
try {
attachmentHandler.uploadAttachment(repository, task, attachment.getComment(), attachment
.getDescription(), new File(attachment.getFilePath()), attachment.getContentType(),
@@ -159,8 +167,10 @@ public class NewAttachmentWizard extends Wizard {
if (attachContext) {
connector.attachContext(repository, task, "");
- // attachContext sets outgoing state but we want to recieve incoming
- // on synchronization. This could result in lost edits so need to
+ // attachContext sets outgoing state but we want to
+ // recieve incoming
+ // on synchronization. This could result in lost edits
+ // so need to
// review the whole attachment interaction.
task.setSyncState(RepositoryTaskSyncState.SYNCHRONIZED);
}
@@ -181,7 +191,7 @@ public class NewAttachmentWizard extends Wizard {
});
}
}
-
+
TasksUiPlugin.getSynchronizationManager().synchronize(connector, task, false, new JobChangeAdapter() {
@Override
public void done(final IJobChangeEvent event) {

Back to the top