Ignore:
Timestamp:
2019-01-08T21:33:32+01:00 (6 years ago)
Author:
simon04
Message:

fix #17185 - Do not offer unsupported file types for saving OsmDataLayer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/widgets/FileChooserManager.java

    r14153 r14668  
    66import java.util.Collection;
    77import java.util.Collections;
     8import java.util.function.Predicate;
    89
    910import javax.swing.JFileChooser;
     
    4647    private int selectionMode = JFileChooser.FILES_ONLY;
    4748    private String extension;
    48     private boolean allTypes;
     49    private Predicate<ExtensionFileFilter> additionalTypes = ignore -> false;
    4950    private File file;
    5051
     
    261262
    262263    /**
     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    /**
    263274     * Builder method to set {@code allTypes} property.
    264275     * @param value If true, all the files types known by JOSM will be proposed in the "file type" combobox.
     
    267278     */
    268279    public FileChooserManager allTypes(boolean value) {
    269         allTypes = value;
     280        additionalTypes = ignore -> value;
    270281        return this;
    271282    }
     
    311322            }
    312323        } else if (open) {
    313             ExtensionFileFilter.applyChoosableImportFileFilters(fc, extension, allTypes);
     324            ExtensionFileFilter.applyChoosableImportFileFilters(fc, extension, additionalTypes);
    314325        } else {
    315             ExtensionFileFilter.applyChoosableExportFileFilters(fc, extension, allTypes);
     326            ExtensionFileFilter.applyChoosableExportFileFilters(fc, extension, additionalTypes);
    316327        }
    317328        return this;
Note: See TracChangeset for help on using the changeset viewer.