--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaFileChooserUI.java Thu Apr 28 19:35:09 2016 +0300
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaFileChooserUI.java Thu Apr 28 23:48:37 2016 +0400
@@ -112,7 +112,7 @@
private AncestorListener ancestorListener = null;
private DropTarget dragAndDropTarget = null;
- private final AcceptAllFileFilter acceptAllFileFilter = new AcceptAllFileFilter();
+ private static final AcceptAllFileFilter acceptAllFileFilter = new AcceptAllFileFilter();
private AquaFileSystemModel model;
@@ -997,7 +997,7 @@
// *****************************************
// ***** default AcceptAll file filter *****
// *****************************************
- protected class AcceptAllFileFilter extends FileFilter {
+ private static class AcceptAllFileFilter extends FileFilter {
public AcceptAllFileFilter() {
}
@@ -1305,6 +1305,8 @@
protected class FilterComboBoxModel extends AbstractListModel<FileFilter> implements ComboBoxModel<FileFilter>,
PropertyChangeListener {
protected FileFilter[] filters;
+ Object oldFileFilter = getFileChooser().getFileFilter();
+
protected FilterComboBoxModel() {
super();
filters = getFileChooser().getChoosableFileFilters();
@@ -1321,12 +1323,17 @@
}
public void setSelectedItem(Object filter) {
- if (filter != null && !containsFileFilter(filter)) {
+ if (filter != null && !isSelectedFileFilterInModel(filter)) {
+ oldFileFilter = filter;
getFileChooser().setFileFilter((FileFilter) filter);
fireContentsChanged(this, -1, -1);
}
}
+ private boolean isSelectedFileFilterInModel(Object filter) {
+ return Objects.equals(filter, oldFileFilter);
+ }
+
public Object getSelectedItem() {
// Ensure that the current filter is in the list.
// NOTE: we shouldnt' have to do this, since JFileChooser adds