Changeset 9466 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2016-01-15T16:00:22+01:00 (9 years ago)
Author:
bastiK
Message:

see #12370, see #12369 - fix problems with default file extension (patch by kolesar)
[patch] adapted osm file filter to other file types

Location:
trunk/src/org/openstreetmap/josm/actions
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/ExtensionFileFilter.java

    r9371 r9466  
    227227                return exporter.filter;
    228228        }
     229        // if extension did not match defaultExtension of any exporter,
     230        // scan all supported extensions
     231        File file = new File("file." + extension);
     232        for (FileExporter exporter : exporters) {
     233            if (exporter.filter.accept(file))
     234                return exporter.filter;
     235        }
    229236        return new AllFormatsImporter().filter;
    230237    }
     
    242249    public static void applyChoosableImportFileFilters(AbstractFileChooser fileChooser, String extension, boolean allTypes) {
    243250        for (ExtensionFileFilter filter: getImportExtensionFileFilters()) {
     251
    244252            if (allTypes || filter.acceptName("file."+extension)) {
    245253                fileChooser.addChoosableFileFilter(filter);
  • trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java

    r9413 r9466  
    169169            // No filefilter accepts current filename, add default extension
    170170            String fn = file.getPath();
    171             if (ff instanceof ExtensionFileFilter) {
     171            if (extension != null) {
     172                fn += '.' + extension;
     173            } else if (ff instanceof ExtensionFileFilter) {
    172174                fn += '.' + ((ExtensionFileFilter) ff).getDefaultExtension();
    173             } else if (extension != null) {
    174                 fn += '.' + extension;
    175175            }
    176176            file = new File(fn);
Note: See TracChangeset for help on using the changeset viewer.