<AWT Dev> Second patch for 6927978 (Directory Selection standard dialog support)

Costantino Cerbo c.cerbo at gmail.com
Mon Oct 4 13:02:14 PDT 2010


Hi Anthony,

I've seen, you have just fixed a small bug about the GTK FileDialog (6987233).

What about the DirectoryDialog (6927978)?
As you known, two thirds of the job are done (I've developed the X11
and GTK peers).
Only the MS Windows peer is still missing. It would be great of
somebody at Oracle could take care of it!

Best Regards,
Costantino

2010/9/8 Costantino Cerbo <c.cerbo at gmail.com>:
> Hello,
>
> what about the DirectoryDialog?
> I implemented on May the part for GTK and X-Windows but we still need
> the peer for MS Windows (webrev:
> http://cr.openjdk.java.net/~anthony/7-45-DirectoryDialog-6927978.1/).
>
> Damjan was going to do it, but we heard nothing from him for months.
> Maybe someone else at Oracle would like to add the support for Windows?
>
> Regards,
> Costantino
>
> 2010/5/26 Anthony Petrov <Anthony.Petrov at sun.com>:
>> Hi Costantino, Damjan,
>>
>> The webrev for the second version is published at:
>>
>> http://cr.openjdk.java.net/~anthony/7-45-DirectoryDialog-6927978.1/
>>
>> On 5/19/2010 1:57 AM Costantino Cerbo wrote:
>>>>
>>>> here is my second patch for the new DirectoryDialog.
>>>> In this new patch I take care of your previous annotations and I've
>>>> also implemented the XDirectoryDialogPeer as we've discussed.
>>>> XDirectoryDialogPeer is largely based on the XFileDialogPeer (there is
>>>> no inheritance because for several reasons, for example the
>>>> constructor, it wasn't a good option).
>>
>> Actually even the constructors (not counting other methods) share quite a
>> bit of code between the XDir and XFile dialogs. The code might  easily be
>> factored out in a separate method (like createGUI() or whatever) which is
>> invoked in the constructor.  A common base class of the two could only
>> create the components related to choosing a directory. The DirDlg would just
>> call the super implementation, and the FileDlg would also add its own
>> components (like the filter, the file names listbox, etc.) Moreover, all
>> this could be just left out in the constructor w/o introducing the
>> createGUI() method.
>>
>> Reducing code duplication would really simplify further maintenance of the
>> classes.
>>
>>
>> src/share/classes/java/awt/DirectoryDialog.java
>>>
>>>  152         if (peer != null) {
>>>  153             ((DirectoryDialogPeer) this.peer).setDirectory(this.dir);
>>>  154         }
>>
>> We use another idiom across the AWT:
>>
>> DirectoryDialogPeer peer = (DirectoryDialogPeer)this.peer;
>> if (peer != null) {
>>   // blah-blah-blah
>> }
>>
>> This way we avoid NPEs should the peer be released and GC'ed just after the
>> if () but before the actual actions.
>>
>>
>>>> We have now the DirectoryDialog for both GTK and X11 but not yet for MS
>>>> Windows!
>>>> @Damjan: Are you still going to implement the DirectoryDialog for MS
>>>> Windows? We didn't hear from you for weeks... it would be great if you
>>>> could do it!
>>
>> Damjan: we look forward to reviewing your implementation of the
>> DirectoryDialog on MS Windows. Thanks in advance!
>>
>> --
>> best regards,
>> Anthony
>>
>



More information about the awt-dev mailing list