<AWT Dev> bug 6913179 (The java.awt.FileDialog should use native GTK file chooser on linux distros) - indentation corrected

Anthony Petrov Anthony.Petrov at Sun.COM
Wed May 5 03:33:32 PDT 2010


On 5/4/2010 7:53 PM Costantino Cerbo wrote:
> Very good!
> If Damjan does tha patch for Windows and I for X11+GTK we need just
> someone else for X11 w/o GTK.
> Eventually I can also do it.

That would be great.


> About the patch for X11+GTK, a new class DirectoryDialog isn't really
> necessary. We can still use FileDialog that already has the method
> getDirectory()

Well, what about the get/setFile(s)(), get/setFilenameFileter(), 
is/setMultipleMode() methods of the FileDialog class? We certainly don't 
want to bloat their specifications with special cases describing that 
they don't have effect in specific modes of the dialog. Besides, its 
name is *File*Dialog which clearly states that it's not supposed to 
choose directories. Also please remember about the Windows platform 
where it's going to use a completely different native actions to display 
the dialog (Shell API vs. CommDlg API for regular file dialogs).

So I suggest to introduce a new class java.awt.DirectoryDialog. This 
class would provide a well-suited API for directory selection operation. 
Also we'll have to introduce a DirectoryDialogPeer at the java.awt.peer 
package, and, of course, its implementations in the platform-specific 
code. For GTK we could have a base class that's able to display a 
generic GTK file-chooser, and this peer may be extended for the 
FileDilaogPeer and DirDialogPeer implementations. Does this sound 
reasonable?

--
best regards,
Anthony

> 
> Cheers,
> Costantino
> 
> 2010/5/4 Damjan Jovanovic <damjan.jov at gmail.com>:
>> On Tue, May 4, 2010 at 4:31 PM, Anthony Petrov <Anthony.Petrov at sun.com> wrote:
>>> Hi Costantino,
>>>
>>> On 05/02/2010 09:43 PM, Costantino Cerbo wrote:
>>>> I was wrong: I meant the issue 6927978 (Directory Selection standard
>>>> dialog support) and not the 6705345 (that's already fixed).
>>>>
>>>> The goal is to add to the FileDialog a feature like the
>>>> JFileChooser#setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY).
>>> Thanks for the correction.
>>>
>>>
>>>> My idea it to allow FileDialog#setMode(.) to accept also the value
>>>> LOAD_DIRECTORIES_ONLY ( = 2).
>>>> It's a minimal change that doesn't broke the existing API. Do you
>>>> agree to do so?
>>> Yes, I strongly agree that AWT FileDialog should support selecting
>>> directories. That might even be another class like DirectoryDialog, since
>>> the API for these operations differs quite a lot. However, currently we have
>>> three different implementations of the FileDialog on:
>>>
>>> 1. MS Windows
>>> 2. X11 + GTK
>>> 3. X11 w/o GTK
>>>
>>> And we actually have to be able to display a directory chooser on each of
>>> the 'platforms' as well. W/o that I'm afraid we can't accept such a fix.
>>>
>> Windows uses a separate dialog for directory-only selection, so a
>> separate DirectoryDialog seems like a good idea.
>>
>>>> I can do the fix for GTK. Does anybody in this mailing list want to
>>>> deliver the patch for windows?
>>> Anyone please?
>> I could make a Windows patch, I've still got a Windows build
>> environment for OpenJDK set up from a while back.
>>
>>> --
>>> best regards,
>>> Anthony
>>>
>> Regards
>> Damjan
>>



More information about the awt-dev mailing list