Changeset 14668 in josm
- Timestamp:
- 2019-01-08T21:33:32+01:00 (6 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/ExtensionFileFilter.java
r13352 r14668 13 13 import java.util.Objects; 14 14 import java.util.ServiceConfigurationError; 15 import java.util.function.Predicate; 15 16 16 17 import javax.swing.filechooser.FileFilter; … … 316 317 * @param fileChooser the file chooser 317 318 * @param extension the default extension 318 * @param a llTypes If true, all the files types known by JOSM will be proposed inthe "file type" combobox.319 * If false, only the file filters that include {@code extension} will be proposed320 * @since 5438321 */322 public static void applyChoosableImportFileFilters(AbstractFileChooser fileChooser, String extension, boolean allTypes) {319 * @param additionalTypes matching types will additionally be added to the "file type" combobox. 320 * @since 14668 (signature) 321 */ 322 public static void applyChoosableImportFileFilters( 323 AbstractFileChooser fileChooser, String extension, Predicate<ExtensionFileFilter> additionalTypes) { 323 324 for (ExtensionFileFilter filter: getImportExtensionFileFilters()) { 324 325 325 if (a llTypes|| filter.acceptName("file."+extension)) {326 if (additionalTypes.test(filter) || filter.acceptName("file."+extension)) { 326 327 fileChooser.addChoosableFileFilter(filter); 327 328 } … … 336 337 * @param fileChooser the file chooser 337 338 * @param extension the default extension 338 * @param a llTypes If true, all the files types known by JOSM will be proposed inthe "file type" combobox.339 * If false, only the file filters that include {@code extension} will be proposed340 * @since 5438341 */342 public static void applyChoosableExportFileFilters(AbstractFileChooser fileChooser, String extension, boolean allTypes) {339 * @param additionalTypes matching types will additionally be added to the "file type" combobox. 340 * @since 14668 (signature) 341 */ 342 public static void applyChoosableExportFileFilters( 343 AbstractFileChooser fileChooser, String extension, Predicate<ExtensionFileFilter> additionalTypes) { 343 344 for (ExtensionFileFilter filter: getExportExtensionFileFilters()) { 344 if (a llTypes|| filter.acceptName("file."+extension)) {345 if (additionalTypes.test(filter) || filter.acceptName("file."+extension)) { 345 346 fileChooser.addChoosableFileFilter(filter); 346 347 } -
trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r14648 r14668 105 105 import org.openstreetmap.josm.gui.io.UploadDialog; 106 106 import org.openstreetmap.josm.gui.io.UploadLayerTask; 107 import org.openstreetmap.josm.gui.io.importexport.NoteExporter; 107 108 import org.openstreetmap.josm.gui.io.importexport.OsmImporter; 109 import org.openstreetmap.josm.gui.io.importexport.ValidatorErrorExporter; 110 import org.openstreetmap.josm.gui.io.importexport.WMSLayerImporter; 108 111 import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer; 109 112 import org.openstreetmap.josm.gui.preferences.display.DrawingPreference; … … 1187 1190 .extension(extension) 1188 1191 .file(file) 1189 .a llTypes(true)1192 .additionalTypes(t -> t != WMSLayerImporter.FILE_FILTER && t != NoteExporter.FILE_FILTER && t != ValidatorErrorExporter.FILE_FILTER) 1190 1193 .getFileForSave(); 1191 1194 } -
trunk/src/org/openstreetmap/josm/gui/widgets/FileChooserManager.java
r14153 r14668 6 6 import java.util.Collection; 7 7 import java.util.Collections; 8 import java.util.function.Predicate; 8 9 9 10 import javax.swing.JFileChooser; … … 46 47 private int selectionMode = JFileChooser.FILES_ONLY; 47 48 private String extension; 48 private boolean allTypes;49 private Predicate<ExtensionFileFilter> additionalTypes = ignore -> false; 49 50 private File file; 50 51 … … 261 262 262 263 /** 264 * Builder method to set {@code additionalTypes} property. 265 * @param value matching types will additionally be added to the "file type" combobox. 266 * @return this 267 */ 268 public FileChooserManager additionalTypes(Predicate<ExtensionFileFilter> value) { 269 additionalTypes = value; 270 return this; 271 } 272 273 /** 263 274 * Builder method to set {@code allTypes} property. 264 275 * @param value If true, all the files types known by JOSM will be proposed in the "file type" combobox. … … 267 278 */ 268 279 public FileChooserManager allTypes(boolean value) { 269 a llTypes =value;280 additionalTypes = ignore -> value; 270 281 return this; 271 282 } … … 311 322 } 312 323 } else if (open) { 313 ExtensionFileFilter.applyChoosableImportFileFilters(fc, extension, a llTypes);324 ExtensionFileFilter.applyChoosableImportFileFilters(fc, extension, additionalTypes); 314 325 } else { 315 ExtensionFileFilter.applyChoosableExportFileFilters(fc, extension, a llTypes);326 ExtensionFileFilter.applyChoosableExportFileFilters(fc, extension, additionalTypes); 316 327 } 317 328 return this;
Note:
See TracChangeset
for help on using the changeset viewer.