Bug 271197 - support saving multiple attachments and remember target directory
Summary: support saving multiple attachments and remember target directory
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P1 enhancement (vote)
Target Milestone: 3.2   Edit
Assignee: Peter Stibrany CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy
Depends on:
Blocks:
 
Reported: 2009-04-03 17:40 EDT by Peter Stibrany CLA
Modified: 2009-05-28 12:24 EDT (History)
1 user (show)

See Also:


Attachments
Implementation of described changes. (24.86 KB, patch)
2009-04-03 17:41 EDT, Peter Stibrany CLA
no flags Details | Diff
mylyn/context/zip (4.55 KB, application/octet-stream)
2009-04-03 17:43 EDT, Peter Stibrany CLA
no flags Details
Fixed NPE when user cancels Save dialog after he chooses not to overwrite existing file (24.94 KB, patch)
2009-04-04 08:06 EDT, Peter Stibrany CLA
no flags Details | Diff
Preferences-related fixes (25.57 KB, patch)
2009-04-13 05:04 EDT, Peter Stibrany CLA
no flags Details | Diff
mylyn/context/zip (8.28 KB, application/octet-stream)
2009-04-13 05:04 EDT, Peter Stibrany CLA
no flags Details
Use WorkbenchUtil.getShell() directly instead of TasksUiInternal.getShell() (42.55 KB, patch)
2009-04-24 17:00 EDT, Peter Stibrany CLA
no flags Details | Diff
Fixed import after moving WorkbenchUtil (19.35 KB, patch)
2009-05-03 09:55 EDT, Peter Stibrany CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Stibrany CLA 2009-04-03 17:40:03 EDT
Hello,

I'd like to contribute modifications to save attachment action in task editor. My goal was to implement following changes:

* Support for saving multiple attachments at once to single directory
* Remember previous directory

Attached patch achieves above by:

* extracting anonymous save action to new SaveAttachmentsAction
* moving getAttachment method from TaskUiMenus to AttachmentUtil, creating new getAttachments, which returns list of selected attachments
* SaveAttachmentsAction works as before if only one attachment is selected
* If multiple attachments are selected, user is asked to choose destination directory. Code then checks target filenames (and asks user if he wants to overwrite existing files), and initiates DownloadAttachmentJob for each attachment
* Target directory is remembered between action invocations (using preferences mechanism). Target directory is also used when doing single-attachment saving (ehnahcement of original code)

Looking forward to your comments.

Thank you,
-Peter
Comment 1 Peter Stibrany CLA 2009-04-03 17:41:00 EDT
Created attachment 130892 [details]
Implementation of described changes.
Comment 2 Peter Stibrany CLA 2009-04-03 17:43:48 EDT
Context.
Comment 3 Peter Stibrany CLA 2009-04-03 17:43:50 EDT
Created attachment 130894 [details]
mylyn/context/zip
Comment 4 Peter Stibrany CLA 2009-04-04 08:06:06 EDT
Created attachment 130915 [details]
Fixed NPE when user cancels Save dialog after he chooses not to overwrite existing file
Comment 5 Steffen Pingel CLA 2009-04-06 05:10:43 EDT
Thanks for the patch Peter! I am currently on vacation and will review the patch next when I get back.
Comment 6 Mik Kersten CLA 2009-04-06 13:48:58 EDT
Thanks Peter, great to see this!
Comment 7 Peter Stibrany CLA 2009-04-13 05:04:55 EDT
Created attachment 131623 [details]
Preferences-related fixes

1) Don't use ConfigurationScope, as it stores preferences to global eclipse install directory
2) Use preferences store from TasksUiPlugin. Moved constant from SaveAttachmentsAction to ITaskUiPreferenceConstants.
Comment 8 Peter Stibrany CLA 2009-04-13 05:04:58 EDT
Created attachment 131624 [details]
mylyn/context/zip
Comment 9 Peter Stibrany CLA 2009-04-24 17:00:41 EDT
Created attachment 133191 [details]
Use WorkbenchUtil.getShell() directly instead of TasksUiInternal.getShell()

Updated patch according to latest change to TasksUiMenus class.
Comment 10 Peter Stibrany CLA 2009-05-03 09:55:38 EDT
Created attachment 134176 [details]
Fixed import after moving WorkbenchUtil
Comment 11 Steffen Pingel CLA 2009-05-20 23:48:28 EDT
Sorry for the slow response and thanks for keeping patch up to date. I'll tentatively schedule this for 3.2 and will try to review the patch in the next few days.
Comment 12 Steffen Pingel CLA 2009-05-28 05:12:23 EDT
Thanks for the great patch, Peter! I have applied it to CVS head with minor refactorings: I have moved the SaveAttachmentsAction to the actions package and renamed a few variables.
Comment 13 Steffen Pingel CLA 2009-05-28 05:13:20 EDT
Reopening to change assignment.
Comment 14 Steffen Pingel CLA 2009-05-28 05:13:48 EDT
Resolved.
Comment 15 Peter Stibrany CLA 2009-05-28 12:24:01 EDT
Thank you Steffen!