Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 205238

Summary: drag and drop multiple attachments only attaches the first in the selection
Product: z_Archived Reporter: Shawn Minto <shawn.minto>
Component: MylynAssignee: maarten meijer <mjmeijer>
Status: RESOLVED FIXED QA Contact:
Severity: minor    
Priority: P4 CC: mik.kersten, mjmeijer, robert.elves, steffen.pingel
Version: unspecifiedKeywords: helpwanted
Target Milestone: 2.3   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
mylyn/context/zip
none
patch
none
mylyn/context/zip
none
patch that displays more than one file error in NewAttachmentWizard window
none
mylyn/context/zip none

Description Shawn Minto CLA 2007-10-02 16:21:51 EDT
Since Mylyn only supports adding 1 attachment at a time, it should warn the user that they cannot attach multiple files when using drag and drop.  Right now, the UI allows the user to select multiple files, drag them to the task, and then only the first file is attached.
Comment 1 Eugene Kuleshov CLA 2007-10-02 17:19:17 EDT
Hmm. Should we fix submitting multiple attachments instead of sily warnings?
Comment 2 Mik Kersten CLA 2007-10-05 22:22:04 EDT
Support for attaching multiple files would be a considerably involved change and that should be a separate bug report.  For now it could indeed make sense to either disable the drop if there is more than one file, or pop up the dialog.

I took a look at this and the problem is that RepositoryTaskEditorDropListener has null event.data whenever the dragging is happening so I'm not sure if we can give feedback.  I'm not sure that a dialog is a better solution than just attaching the first file.
Comment 3 Mik Kersten CLA 2007-10-05 22:22:07 EDT
Created attachment 79841 [details]
mylyn/context/zip
Comment 4 maarten meijer CLA 2008-01-29 08:58:26 EST
 (In reply to comment #2)
> I'm not sure that a dialog is a better solution than just attaching the first file.
Why not attach the first and warn that the others are not attached, with a button or URL to vote for the bug with the more involved change... 
Comment 5 Mik Kersten CLA 2008-01-31 21:34:10 EST
A dialog sounds good to me.  Interested in a patch?  Note that we can't link directly to the bug because there are redistributions of Mylyn (e.g. JBuilder).  
Comment 6 maarten meijer CLA 2008-02-01 06:23:30 EST
 (In reply to comment #5)
> A dialog sounds good to me.  Interested in a patch?  Note that we can't link
> directly to the bug because there are redistributions of Mylyn (e.g. JBuilder).
Doesn't sound too hard, so assign to me. Should the dialog be shown before or after the attachment wizard is shown?
Comment 7 maarten meijer CLA 2008-02-02 11:17:39 EST
Created attachment 88671 [details]
patch

This patch does the following:
- the first file is attached as standard.
- when more files were dragged a warning dialog is shown, telling to drag the remaining files one by one.
Comment 8 maarten meijer CLA 2008-02-02 11:17:41 EST
Created attachment 88672 [details]
mylyn/context/zip
Comment 9 maarten meijer CLA 2008-02-11 12:36:13 EST
OK Mik,
you can assgn to me
Comment 10 Mik Kersten CLA 2008-02-12 12:56:15 EST
Steffen: please review.
Comment 11 Steffen Pingel CLA 2008-02-17 02:32:02 EST
I find it a little intrusive to display a dialog. How about showing a warning in the header of the attachment dialog that the other dropped files are being ignored?

Maarten, concerning the current patch: could you make sure the warning is not displayed when the user cancels the attachment dialog?
Comment 12 Eugene Kuleshov CLA 2008-02-17 12:59:06 EST
The proposed solution look like patching some holes in the UI but it isn't really solves the issue. Why can't we submit multiple attachments one by one using the current API?
Comment 13 maarten meijer CLA 2008-02-18 09:17:56 EST
 (In reply to comment #12)
> The proposed solution look like patching some holes in the UI but it isn't
> really solves the issue. Why can't we submit multiple attachments one by one
> using the current API?
True intention was to do some UI cleanup in time for 2.3 with bigger solution for 3.0.

It's feasible to loop through all selected items and submit them one by one. 
But then it must be possible to prepopulate the fields (or you have to enter them again and again)

Its also possible to create a check box list of selected items to attach where you can make a final selection of the items and enter only one comment.

A third option is to ZIP all the selected items together and upload as one file.

Finally it may mean that people want to create a patch of the selected items. For this it would be good to add a specific Create and attach patch... button/action next to Attach screenshot...
Then dragging multiple CVS controlled items to the attachments title should be interpreted as "Creat and attach patch..."

Maybe do the simple thing first...
  
Comment 14 Steffen Pingel CLA 2008-02-18 13:43:30 EST
Yes. it's perfectly fine to go for the simple solution first. I'll apply the patch if the concern in comment 11 is addressed.
Comment 15 Eugene Kuleshov CLA 2008-02-18 13:54:20 EST
My point was that significant effort been put into this, which also has certain impact on user interaction. Now you are saying that the plan is to redo it in next few months, which sound like waste of effort. Hope it worth it.

PS: create CVS patch will be problematic as that is not public API
Comment 16 Mik Kersten CLA 2008-02-19 01:58:54 EST
Maarten: Please do proceed with the simple solution first as per your inclination and Steffen's suggestion.  Displaying the warning in the wizard dialog title header sounds great.  Steffen can provide pointers to how we do that if needed.
Comment 17 maarten meijer CLA 2008-02-19 03:37:25 EST
Created attachment 90037 [details]
patch that displays more than one file error in NewAttachmentWizard window

As per suggestions in the bug report.
Comment 18 maarten meijer CLA 2008-02-19 03:37:27 EST
Created attachment 90038 [details]
mylyn/context/zip
Comment 19 Steffen Pingel CLA 2008-02-19 16:17:17 EST
Good stuff! Patch applied and ip log updated. I have added your name to the authors and modified the message slightly to make externalization easier (bug 215116). I have also changed it to be a warning rather than an error. Technically the user can continue in that state and the Eclipse UI guidelines recommend that wizards should not start with an error:

http://www.eclipse.org/articles/Article-UI-Guidelines/Contents.html#Wizards
Comment 20 maarten meijer CLA 2008-02-19 17:31:40 EST
(In reply to comment #19)
> I have also changed it to be a warning rather than an error.
> Technically the user can continue in that state and the Eclipse UI guidelines
> recommend that wizards should not start with an error:
I started with a warning as well, but then it never showed in the header, just the ordinary message.
Must have missed something :-(