Changeset 8895 in josm


Ignore:
Timestamp:
2015-10-18T13:00:40+02:00 (4 years ago)
Author:
simon04
Message:

Refactor usage of ExtensionFileFilter introduced in r8894

Location:
trunk/src/org/openstreetmap/josm
Files:
5 edited

Legend:

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

    r8894 r8895  
    287287     * @param defaultExtension The default extension
    288288     * @param description A short textual description of the file type without supported extensions in parentheses
     289     * @param addArchiveExtensionsToDescription Whether to also add the archive extensions to the description
    289290     * @return The constructed filter
    290291     */
    291     public static ExtensionFileFilter newFilterWithArchiveExtensions(String extensions, String defaultExtension, String description) {
     292    public static ExtensionFileFilter newFilterWithArchiveExtensions(
     293            String extensions, String defaultExtension, String description, boolean addArchiveExtensionsToDescription) {
    292294        final Collection<String> extensionsPlusArchive = new LinkedHashSet<>();
    293295        final Collection<String> extensionsForDescription = new LinkedHashSet<>();
     
    297299            extensionsPlusArchive.add(e + ".bz2");
    298300            extensionsForDescription.add("*." + e);
    299             // intentionally do not add [e].gz and [e].bz2 to extensionsForDescription in order to avoid long texts
     301            if (addArchiveExtensionsToDescription) {
     302                extensionsForDescription.add("*." + e + ".gz");
     303                extensionsForDescription.add("*." + e + ".bz2");
     304            }
    300305        }
    301306        return new ExtensionFileFilter(Utils.join(",", extensionsPlusArchive), defaultExtension,
  • trunk/src/org/openstreetmap/josm/io/GpxImporter.java

    r7033 r8895  
    2828     * The GPX file filter (*.gpx and *.gpx.gz files).
    2929     */
    30     public static final ExtensionFileFilter FILE_FILTER = new ExtensionFileFilter(
    31             "gpx,gpx.gz,gpx.bz2", "gpx", tr("GPX Files") + " (*.gpx *.gpx.gz, *.gpx.bz2)");
     30    public static final ExtensionFileFilter FILE_FILTER = ExtensionFileFilter.newFilterWithArchiveExtensions(
     31            "gpx", "gpx", tr("GPX Files"), true);
    3232
    3333    /**
  • trunk/src/org/openstreetmap/josm/io/NMEAImporter.java

    r8894 r8895  
    3131     */
    3232    public static final ExtensionFileFilter FILE_FILTER = ExtensionFileFilter.newFilterWithArchiveExtensions(
    33             "nmea,nme,nma,log,txt", "nmea", tr("NMEA-0183 Files"));
     33            "nmea,nme,nma,log,txt", "nmea", tr("NMEA-0183 Files"), false);
    3434
    3535    /**
  • trunk/src/org/openstreetmap/josm/io/NoteImporter.java

    r7870 r8895  
    1818
    1919/**
    20  * File importer that reads note dump files (*.osn and .osn.bz2)
     20 * File importer that reads note dump files (*.osn, .osn.gz and .osn.bz2)
    2121 * @since 7538
    2222 */
    2323public class NoteImporter extends FileImporter {
    2424
    25     private static final ExtensionFileFilter FILE_FILTER = new ExtensionFileFilter(
    26             "osn,osn.bz2", "osn", tr("Note Files") + " (*.osn *.osn.bz2)");
     25    private static final ExtensionFileFilter FILE_FILTER = ExtensionFileFilter.newFilterWithArchiveExtensions(
     26            "osn", "osn", tr("Note Files"), true);
    2727
    2828    /** Create an importer for note dump files */
  • trunk/src/org/openstreetmap/josm/io/OsmChangeImporter.java

    r8855 r8895  
    2020public class OsmChangeImporter extends FileImporter {
    2121
    22     public static final ExtensionFileFilter FILE_FILTER = new ExtensionFileFilter(
    23             "osc,osc.bz2,osc.bz,osc.gz", "osc", tr("OsmChange File") + " (*.osc *.osc.bz2 *.osc.bz *.osc.gz)");
     22    public static final ExtensionFileFilter FILE_FILTER = ExtensionFileFilter.newFilterWithArchiveExtensions(
     23            "osc", "osc", tr("OsmChange File"), true);
    2424
    2525    /**
Note: See TracChangeset for help on using the changeset viewer.