Ticket #5757: RecentFiles2.patch
File RecentFiles2.patch, 2.1 KB (added by , 14 years ago) |
---|
-
src/org/openstreetmap/josm/actions/OpenFileAction.java
243 243 Collections.reverse(ims); 244 244 245 245 Set<String> fileHistory = new LinkedHashSet<String>(); 246 List<String> failedHistory = new ArrayList<String>(); 246 247 247 248 for (FileImporter importer : ims) { 248 249 List<File> files = new ArrayList<File>(map.get(importer)); 249 250 importData(importer, files); 251 // suppose all files will fail to load 252 List<File> failedFiles = new ArrayList<File>(files); 250 253 251 254 if (recordHistory && !importer.isBatchImporter()) { 255 // only add those files which really have been opened successfully 256 files.retainAll(successfullyOpenedFiles); 257 // remove the files which didn't fail to load from the failed list 258 failedFiles.removeAll(successfullyOpenedFiles); 252 259 for (File f : files) { 253 260 fileHistory.add(f.getPath()); 254 261 } 262 for (File f : failedFiles) { 263 failedHistory.add(f.getPath()); 264 } 255 265 } 256 266 } 257 267 258 268 if (recordHistory) { 259 269 Collection<String> oldFileHistory = Main.pref.getCollection("file-open.history"); 260 270 fileHistory.addAll(oldFileHistory); 271 // remove the files which failed to load from the list 272 fileHistory.removeAll(failedHistory); 261 273 int maxsize = Math.max(0, Main.pref.getInteger("file-open.history.max-size", 15)); 262 274 Collection<String> trimmedFileHistory = new ArrayList<String>(Math.min(maxsize, fileHistory.size())); 263 275 int i = 0;