Marco, I don't know, but I'm just describing the same behaviors that was in the previous Apple Java implementations (i.e. choosing directories only + using [Choose] ) when setting the apple.awt.fileDialogForDirectoriessystem property flag.
I should know because, about 2 years ago, I filed the same bug for Apple Java to be consistent with it's previous versions. It looks like they just hard coded the [Choose] button text because when I run it with different locales set, it always says [Choose]. Thanks again for all your hard work! Mike >________________________________ > From: Marco Dinacci <[email protected]> >To: "[email protected]" ><[email protected]> >Cc: Sergey Bylokhov <[email protected]>; >"[email protected]" <[email protected]>; >"[email protected]" <[email protected]>; Anthony Petrov ><[email protected]> >Sent: Thursday, August 9, 2012 4:54 AM >Subject: Re: [8] Review request for 7161437: [macosx] awt.FileDialog doesn't >respond appropriately for mac when selecting folders > >Hi, > >> Just so that you know, the behavior of this dialog is different than the >> default OS X directory chooser behavior in that directory choosers to not >> allow users to also select files. > >True but unfortunately if you allow only for directory selection (by >passing NO to setCanChooseFiles: when fCanChooseDirectories is YES) >then there's no way to allow for both file and directory selection. >The best would be to have control over both setCanChooseFiles and >setCanChooseDirectories from Java but I guess that's part of the RFE. > >>Also the default select button should read [Choose] and not [Open]. So in the >>CFileDialog.m file the private method : > >The CFileDialog doesn't explicitly set the prompt string so I guess >the behaviour depends on the OS version or on the localization. >Setting it explicitly would override the default string and >potentially confuse users. This test program on OSX Lion always >displays "Open" no matter which combination of YES an NO I pass to >setCanChooseFiles and setCanChooseDirectories. On which OS version do >you see "Choose" ? > >#import "AppDelegate.h" > >@implementation AppDelegate > >@synthesize window = _window; > >- (void)applicationDidFinishLaunching:(NSNotification *)aNotification >{ > NSButton *button = [[[NSButton alloc] initWithFrame: > NSMakeRect(10,10,120,40)] autorelease]; > [[_window contentView] addSubview: button]; > [button setTitle: @"Button"]; > [button setTarget:self]; > [button setAction:@selector(openDialog)]; >} > >- (void)openDialog >{ > NSOpenPanel* openDlg = [NSOpenPanel openPanel]; > [openDlg setCanChooseFiles:YES]; > [openDlg setCanChooseDirectories:YES]; > [openDlg runModalForDirectory:nil file:nil]; >} > >@end > >Best, >Marco > > >
