Le 27/09/2013 01:14, Camillo Bruni a écrit :
On 2013-09-26, at 15:50, GOUBIER Thierry <thierry.goubier@cea.fr> wrote:
Thanks, Sean, I'm happy that after Erwan suggestion of an issue, someone took charge of cleaning that :)
My own position is that current Pharo has unified the filesystem issue with FileReference, and that I'm not impressed by moving ten variants of an API for choosing files from one class to another. But that's just me :)
I think at the core we have a single method which returns FileReferences, and which has four parameters: title, start path, pattern, name (no need for an open). I'll move some of the API complexity in the pattern object, so that it may be able to make the distinction between files and directory, and of course extensions (with a reflective method to list the possible extensions). The pattern should be easy to create :), i.e. nil, '*.png', #isADirectory, whatever. All parameters may be nil, and like that there isn't any dependency on Morphic or the command line.
answer := UIManager default chooseFileReference: 'Select a file' path: aFileReference pattern: '*.png' name: nil
(name: is for those Save As dialogs where you already have a pre-existing file name)
I would also say that spans over the most common options. Convert #pattern: to #filter: which takes a block over the shown file reference and you can implement almost everything ;)
The block idea is good, but I'd prefer something that the GUI can query for some information, such as the list of file patterns (which is often listed in those file open, file save as dialog boxes). Hence the FilePattern idea. Thierry -- Thierry Goubier CEA list Laboratoire des Fondations des Systèmes Temps Réel Embarqués 91191 Gif sur Yvette Cedex France Phone/Fax: +33 (0) 1 69 08 32 92 / 83 95