Possible regression: FileDialog allowing selection of files with apple.awt.fileDialogForDirectories == true

Alexander Scherbatiy alexandr.scherbatiy at oracle.com
Mon Sep 9 03:44:10 PDT 2013



   The "apple.awt.fileDialogForDirectories" property implementation has 
been added as fix for the issue
     7161437 [macosx] awt.FileDialog doesn't respond appropriately for 
mac when selecting folders
     http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7161437

  The value of the "apple.awt.fileDialogForDirectories" property is  set 
to the NSOpenPanel by setCanChooseDirectories method:
https://developer.apple.com/library/mac/documentation/cocoa/reference/applicationkit/Classes/NSOpenPanel_Class/Reference/Reference.html#//apple_ref/occ/instm/NSOpenPanel/setCanChooseDirectories:

  You can submit the bug that there is the difference of 
"apple.awt.fileDialogForDirectories" property usage between Apple JDK 
and  OpenJDK on http://bugreport.sun.com/bugreport/ page.

  Thanks,
  Alexandr.


On 9/8/2013 7:31 PM, Paul Taylor wrote:
> On 08/09/2013 11:44, Robert Krüger wrote:
>> Hi,
>>
>> for ages we have been using the following approach to show a native
>> file dialog to choose a directory:
>>
>> FileDialog fileDialog = .....;
>>
>> fileDialog.setMode(FileDialog.LOAD);
>>          try {
>> System.setProperty("apple.awt.fileDialogForDirectories", "true");
>>              fileDialog.setVisible(true);
>>          } finally {
>> System.setProperty("apple.awt.fileDialogForDirectories", "false");
>>          }
>>
>> Now I noticed with build 103 that this allows me to select files as
>> well. Starting the same application with Apple's JDK 6 behaves as
>> expected. I cannot prove this right now but I am quite sure that I
>> specifically tested this with an OpenJDK 8 build a few months ago and
>> it worked. So this appears like a regression but I might be wrong.
>>
>> Is this known or should I file a bug report?
>>
>> Regards,
>>
>> Robert
>>
> I call System.setProperty() first before I construct the fileDialog I 
> don't know if that makes any difference.
> But that works for me using 7u40 Build b40
>
> Paul



More information about the macosx-port-dev mailing list