Changeset 2001 in josm


Ignore:
Timestamp:
2009-08-29T11:08:38+02:00 (12 years ago)
Author:
Gubaer
Message:

applied #3319: patch by bastiK: "open" dialog now filters "OSM server files" first when 99% people use it for GPX files

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

Legend:

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

    r1978 r2001  
    3838        for (FileImporter imExporter: ExtensionFileFilter.importers) {
    3939            fc.addChoosableFileFilter(imExporter.filter);
    40             if (imExporter.filter.defaultExtension.endsWith("osm")) {
     40            if (imExporter instanceof ExtensionFileFilter.AllFormatsImporter) {
    4141                defaultFilter = imExporter.filter;
    4242            }
  • trunk/src/org/openstreetmap/josm/actions/ExtensionFileFilter.java

    r1949 r2001  
    11// License: GPL. Copyright 2007 by Immanuel Scholz and others
    22package org.openstreetmap.josm.actions;
     3
     4import static org.openstreetmap.josm.tools.I18n.tr;
    35
    46import java.io.File;
     
    3133    public final String defaultExtension;
    3234
     35    /**
     36     * list of supported formats
     37     */
    3338    public static ArrayList<FileImporter> importers = new ArrayList<FileImporter>(Arrays.asList(new OsmImporter(),
    34             new OsmGzipImporter(), new OsmBzip2Importer(), new GpxImporter(), new NMEAImporter()));
     39            new OsmGzipImporter(), new OsmBzip2Importer(), new GpxImporter(), new NMEAImporter(), new AllFormatsImporter()));
    3540
    36     // list of supported export formats
    3741    public static ArrayList<FileExporter> exporters = new ArrayList<FileExporter>(Arrays.asList(new GpxExporter(),
    3842            new OsmExporter(), new OsmGzipExporter(), new OsmBzip2Exporter()));
    39 
     43   
    4044    /**
    4145     * Construct an extension file filter by giving the extension to check after.
    42      *
    4346     */
    4447    public ExtensionFileFilter(String extension, String defExt, String description) {
     
    6568        return description;
    6669    }
     70   
     71    /**
     72     * Dummy importer that adds the "All Formats"-Filter when opening files
     73     */
     74    public static class AllFormatsImporter extends FileImporter {
     75        public AllFormatsImporter() {
     76            super(
     77                new ExtensionFileFilter("osm,xml,osm.gz,osm.bz2,osm.bz,gpx,gpx.gz,nmea,nme,nma,txt", "", tr("All Formats")
     78                        + " (*.gpx *.osm *.nmea ...)"));
     79        }
     80        @Override public boolean acceptFile(File pathname) {
     81            return false;
     82        }
     83    }
    6784}
  • trunk/src/org/openstreetmap/josm/io/OsmBzip2Importer.java

    r1653 r2001  
    1616
    1717    public OsmBzip2Importer() {
    18         super(new ExtensionFileFilter("osm.bz2, osm.bz", "osm.bz2", tr("OSM Server Files bzip2 compressed")
     18        super(new ExtensionFileFilter("osm.bz2,osm.bz", "osm.bz2", tr("OSM Server Files bzip2 compressed")
    1919                + " (*.osm.bz2 *.osm.bz)"));
    2020    }
Note: See TracChangeset for help on using the changeset viewer.