< prev index next >

src/java.desktop/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java

Print this page




1117                     try {
1118                         globFilter.setPattern(selectedFile.getName());
1119                         if (!(currentFilter instanceof GlobFilter)) {
1120                             actualFileFilter = currentFilter;
1121                         }
1122                         chooser.setFileFilter(null);
1123                         chooser.setFileFilter(globFilter);
1124                         return;
1125                     } catch (PatternSyntaxException pse) {
1126                         // Not a valid glob pattern. Abandon filter.
1127                     }
1128                 }
1129 
1130                 resetGlobFilter();
1131 
1132                 // Check for directory change action
1133                 boolean isDir = (selectedFile != null && selectedFile.isDirectory());
1134                 boolean isTrav = (selectedFile != null && chooser.isTraversable(selectedFile));
1135                 boolean isDirSelEnabled = chooser.isDirectorySelectionEnabled();
1136                 boolean isFileSelEnabled = chooser.isFileSelectionEnabled();

1137                 boolean isCtrl = (e != null && (e.getModifiers() &
1138                             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()) != 0);
1139 
1140                 if (isDir && isTrav && (isCtrl || !isDirSelEnabled)) {
1141                     changeDirectory(selectedFile);
1142                     return;
1143                 } else if ((isDir || !isFileSelEnabled)
1144                         && (!isDir || !isDirSelEnabled)
1145                         && (!isDirSelEnabled || selectedFile.exists())) {
1146                     selectedFile = null;
1147                 }
1148             }
1149 
1150             if (selectedFiles != null || selectedFile != null) {
1151                 if (selectedFiles != null || chooser.isMultiSelectionEnabled()) {
1152                     if (selectedFiles == null) {
1153                         selectedFiles = new File[] { selectedFile };
1154                     }
1155                     chooser.setSelectedFiles(selectedFiles);
1156                     // Do it again. This is a fix for bug 4949273 to force the




1117                     try {
1118                         globFilter.setPattern(selectedFile.getName());
1119                         if (!(currentFilter instanceof GlobFilter)) {
1120                             actualFileFilter = currentFilter;
1121                         }
1122                         chooser.setFileFilter(null);
1123                         chooser.setFileFilter(globFilter);
1124                         return;
1125                     } catch (PatternSyntaxException pse) {
1126                         // Not a valid glob pattern. Abandon filter.
1127                     }
1128                 }
1129 
1130                 resetGlobFilter();
1131 
1132                 // Check for directory change action
1133                 boolean isDir = (selectedFile != null && selectedFile.isDirectory());
1134                 boolean isTrav = (selectedFile != null && chooser.isTraversable(selectedFile));
1135                 boolean isDirSelEnabled = chooser.isDirectorySelectionEnabled();
1136                 boolean isFileSelEnabled = chooser.isFileSelectionEnabled();
1137                 @SuppressWarnings("deprecation")
1138                 boolean isCtrl = (e != null && (e.getModifiers() &
1139                             Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()) != 0);
1140 
1141                 if (isDir && isTrav && (isCtrl || !isDirSelEnabled)) {
1142                     changeDirectory(selectedFile);
1143                     return;
1144                 } else if ((isDir || !isFileSelEnabled)
1145                         && (!isDir || !isDirSelEnabled)
1146                         && (!isDirSelEnabled || selectedFile.exists())) {
1147                     selectedFile = null;
1148                 }
1149             }
1150 
1151             if (selectedFiles != null || selectedFile != null) {
1152                 if (selectedFiles != null || chooser.isMultiSelectionEnabled()) {
1153                     if (selectedFiles == null) {
1154                         selectedFiles = new File[] { selectedFile };
1155                     }
1156                     chooser.setSelectedFiles(selectedFiles);
1157                     // Do it again. This is a fix for bug 4949273 to force the


< prev index next >