views:

190

answers:

0

We have been using JFileChoosers with quaqua LAF on the mac but I need to migrate our file choosers to the native mac filechoosers (I know its going to ruin portability but this is what people want). There were to main file choosers I needed to port the openProjectFileChooser just needed to select a file to be opened and this was no problem using FileDialog but when trying to do the same for a NewProjectFileChooser I ran into trouble. This file chooser needs to allow the user select an appropriate directory, allow them to name the new project but then somehow not actually do the save. I initially tried this using the save mode on FileDialog I.E:

        System.setProperty("apple.awt.fileDialogForDirectories", "true");
        FileDialog fd = new FileDialog(this,rsc.str("458"),FileDialog.SAVE);
        fd.setDirectory(_projectsBaseDir.getPath());
        fd.setLocation(50,50);
        fd.setVisibile(true);

My problem is that when the file already exists the OSX error dialog pops up asking if the user would like to replace the file that already exists but in my application I do not want to allow the user to overwrite existing file with this chooser so I have a dialog that pops up telling them they need to pick a new name right after this. Is there a way to disable this dialog? Or is there a more flexible way to access the OSX file chooser?