8000969: [macosx] Directories are not deselected when JFileChooser has FILES_ONLY selection mode

Reviewed-by: rupashka
This commit is contained in:
Alexander Scherbatiy 2012-10-17 17:33:26 +04:00
parent 336948d514
commit 721264460a

View File

@ -379,6 +379,19 @@ public class AquaFileChooserUI extends FileChooserUI {
}
}
updateButtonState(getFileChooser());
} else if (prop.equals(JFileChooser.SELECTED_FILES_CHANGED_PROPERTY)) {
JFileChooser fileChooser = getFileChooser();
if (!fileChooser.isDirectorySelectionEnabled()) {
final File[] files = (File[]) e.getNewValue();
if (files != null) {
for (int selectedRow : fFileList.getSelectedRows()) {
File file = (File) fFileList.getValueAt(selectedRow, 0);
if (fileChooser.isTraversable(file)) {
fFileList.removeSelectedIndex(selectedRow);
}
}
}
}
} else if (prop.equals(JFileChooser.DIRECTORY_CHANGED_PROPERTY)) {
fFileList.clearSelection();
final File currentDirectory = getFileChooser().getCurrentDirectory();