Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 356438 - [FileDialog] in addition to filePaths also provide fileNames of uploaded files
Summary: [FileDialog] in addition to filePaths also provide fileNames of uploaded files
Status: RESOLVED WONTFIX
Alias: None
Product: RAP
Classification: RT
Component: Incubator (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-01 03:54 EDT by Werner Hihn CLA
Modified: 2011-09-01 10:21 EDT (History)
1 user (show)

See Also:


Attachments
proposed patch (4.05 KB, patch)
2011-09-01 03:58 EDT, Werner Hihn CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Werner Hihn CLA 2011-09-01 03:54:20 EDT
Build Identifier: v14_Maintenance

FileDialog.getFileNames() returns the absolute paths of the uploaded files. I'm using this from within a wizard, and want to display the files in the next wizard step (after the FileDialog was closed). But the user is not interested in the absolute paths on the server, the fileNames would be sufficient.

So my suggestion would be to provide two methods: 
getFilePaths()
getFileNames()

Reproducible: Always
Comment 1 Werner Hihn CLA 2011-09-01 03:58:03 EDT
Created attachment 202587 [details]
proposed patch
Comment 2 Werner Hihn CLA 2011-09-01 04:18:05 EDT
I just realized that this is a single sourced component, and the attached patch of course doesn' t fit very well into the original FileDialog API..

Any other ideas how to fix the issue without breaking the API?
Comment 3 Austin Riddle CLA 2011-09-01 10:10:43 EDT
(In reply to comment #2)
> I just realized that this is a single sourced component, and the attached patch
> of course doesn' t fit very well into the original FileDialog API..
> 
> Any other ideas how to fix the issue without breaking the API?

Hi Werner,

You are correct. Adding API to the file dialog should be avoided if possible. There is one method already that is not part of the FileDialog API, namely setAutoUpload(boolean), but we are trying to remove that as well.

What I suggest is to extract the filenames from the returned paths using File.separator and string manipulation methods.
Comment 4 Austin Riddle CLA 2011-09-01 10:12:31 EDT
(In reply to comment #1)
> Created attachment 202587 [details]
> proposed patch

Thank you very much for attempting to provide a patch.
Comment 5 Werner Hihn CLA 2011-09-01 10:21:54 EDT
(In reply to comment #3)

> What I suggest is to extract the filenames from the returned paths using
> File.separator and string manipulation methods.

Thanks Austin, I already thaught about doing that on my own. I just wanted to avoid string manipulation if possible, and thought this would probably be a common use case in RAP context. 

Of course I understand your decision not to add API because of single sourcing.