Fix for issue #76: Can't select directories in the 'specify location...' dialog of the installer. This was by design before (you pick the executable), but issue #76 convinced me the past design was stupid.

This commit is contained in:
Reinier Zwitserloot committed 2009-12-04 22:10:23 +01:00
1 parent 770975ea6b
commit 3fc9fdb485
1 file changed
+4 -2
@@ -311,8 +311,10 @@ public class InstallerGUI {
String file = null;
if (IdeFinder.getOS() == OS.MAC_OS_X) {
System.setProperty("apple.awt.fileDialogForDirectories", "true");
FileDialog chooser = new FileDialog(appWindow);
chooser.setMode(FileDialog.LOAD);
chooser.setFilenameFilter(new FilenameFilter() {
@Override public boolean accept(File dir, String fileName) {
for (Pattern exeName : exeNames) if (exeName.matcher(fileName).matches()) return true;
@@ -327,11 +329,11 @@ public class InstallerGUI {
JFileChooser chooser = new JFileChooser();
chooser.setAcceptAllFileFilterUsed(false);
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
chooser.setFileFilter(new FileFilter() {
@Override public boolean accept(File f) {
for (Pattern exeName : exeNames) if (exeName.matcher(f.getName()).matches()) return true;
if (f.isDirectory()) return true;
for (Pattern exeName : exeNames) if (exeName.matcher(f.getName()).matches()) return true;
return false;
}