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

Bug 480864

Summary: [FileDialog] style SWT.SINGLE - support multiple uploading but "select" last uploaded filename
Product: [RT] RAP Reporter: Martin Ferlan <martin.ferlan>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: rsternberg
Version: 3.0   
Target Milestone: 3.1 M4   
Hardware: All   
OS: All   
Whiteboard:

Description Martin Ferlan CLA 2015-10-28 09:05:43 EDT
We are experiencing ambiguous behavior when FileDialog is configured with single file upload selection.
Selection of file using 'Browse' button uploads selected file and disables 'Browse' button. But another file can be uploaded by simply dropping file on "dialogArea".
Method getFileName() returns filename of first uploaded file
Method getFileNames() returns list of filenames
FileDialog shows only first uploaded filename (UploadPanel) due to height limitations but are present.

Therefore FileDialog with SWT.SINGLE style is similar with SWT.MULTI style.
Difference is shell height, text on 'Browse/Add' button (FileUpload) and restriction that it is disabled after first upload.

Expected behavior would be to replace previously uploaded file 
every time.

Changes required (all applied when style SWT.SINGLE):
1. do not hide fileUpload when style SWT.SINGLE in method 'updateButtonsArea'
2. in methods 'handleFileDrop' and 'handleFileUploadSelection' instead of placeHolder.dispose code should dispose children (all UploadPanels) of the scrolled composite content.
3. getFileNames() method should return list containing only single file name (last uploaded). 
4. getFileName() should return last uploaded file

Due to bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=480863
5. 'handleFileUploadSelection' exit method if fileUpload.getFileNames() is empty, otherwise in scenario described in above bug, OK button will be disabled and upload panels disposed.

 
Can be tested with Examples Demo -> Key Features -> File Upload page -> File Dialog, Single File
As long as you work with equinox.http.jetty version up to 3.1.0.v20150323-1312 (due to bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=479113)
Comment 1 Ralf Sternberg CLA 2015-11-20 06:57:07 EST
I agree with the suggestion to allow replacing the selected file instead of disabling the browse button.
Comment 2 Ivan Furnadjiev CLA 2015-12-04 09:04:23 EST
Fixed with change https://git.eclipse.org/r/#/c/61635/