| 1 | Index: src/org/openstreetmap/josm/actions/ExtensionFileFilter.java
|
|---|
| 2 | ===================================================================
|
|---|
| 3 | --- src/org/openstreetmap/josm/actions/ExtensionFileFilter.java (revision 1992)
|
|---|
| 4 | +++ src/org/openstreetmap/josm/actions/ExtensionFileFilter.java (working copy)
|
|---|
| 5 | @@ -1,6 +1,8 @@
|
|---|
| 6 | // License: GPL. Copyright 2007 by Immanuel Scholz and others
|
|---|
| 7 | package org.openstreetmap.josm.actions;
|
|---|
| 8 |
|
|---|
| 9 | +import static org.openstreetmap.josm.tools.I18n.tr;
|
|---|
| 10 | +
|
|---|
| 11 | import java.io.File;
|
|---|
| 12 | import java.util.ArrayList;
|
|---|
| 13 | import java.util.Arrays;
|
|---|
| 14 | @@ -30,16 +32,17 @@
|
|---|
| 15 | private final String description;
|
|---|
| 16 | public final String defaultExtension;
|
|---|
| 17 |
|
|---|
| 18 | + /**
|
|---|
| 19 | + * list of supported formats
|
|---|
| 20 | + */
|
|---|
| 21 | public static ArrayList<FileImporter> importers = new ArrayList<FileImporter>(Arrays.asList(new OsmImporter(),
|
|---|
| 22 | - new OsmGzipImporter(), new OsmBzip2Importer(), new GpxImporter(), new NMEAImporter()));
|
|---|
| 23 | + new OsmGzipImporter(), new OsmBzip2Importer(), new GpxImporter(), new NMEAImporter(), new AllFormatsImporter()));
|
|---|
| 24 |
|
|---|
| 25 | - // list of supported export formats
|
|---|
| 26 | public static ArrayList<FileExporter> exporters = new ArrayList<FileExporter>(Arrays.asList(new GpxExporter(),
|
|---|
| 27 | new OsmExporter(), new OsmGzipExporter(), new OsmBzip2Exporter()));
|
|---|
| 28 | -
|
|---|
| 29 | +
|
|---|
| 30 | /**
|
|---|
| 31 | * Construct an extension file filter by giving the extension to check after.
|
|---|
| 32 | - *
|
|---|
| 33 | */
|
|---|
| 34 | public ExtensionFileFilter(String extension, String defExt, String description) {
|
|---|
| 35 | this.extension = extension;
|
|---|
| 36 | @@ -64,4 +67,18 @@
|
|---|
| 37 | @Override public String getDescription() {
|
|---|
| 38 | return description;
|
|---|
| 39 | }
|
|---|
| 40 | +
|
|---|
| 41 | + /**
|
|---|
| 42 | + * Dummy importer that adds the "All Formats"-Filter when opening files
|
|---|
| 43 | + */
|
|---|
| 44 | + public static class AllFormatsImporter extends FileImporter {
|
|---|
| 45 | + public AllFormatsImporter() {
|
|---|
| 46 | + super(
|
|---|
| 47 | + new ExtensionFileFilter("osm,xml,osm.gz,osm.bz2,osm.bz,gpx,gpx.gz,nmea,nme,nma,txt", "", tr("All Formats")
|
|---|
| 48 | + + " (*.gpx *.osm *.nmea ...)"));
|
|---|
| 49 | + }
|
|---|
| 50 | + @Override public boolean acceptFile(File pathname) {
|
|---|
| 51 | + return false;
|
|---|
| 52 | + }
|
|---|
| 53 | + }
|
|---|
| 54 | }
|
|---|
| 55 | Index: src/org/openstreetmap/josm/actions/DiskAccessAction.java
|
|---|
| 56 | ===================================================================
|
|---|
| 57 | --- src/org/openstreetmap/josm/actions/DiskAccessAction.java (revision 1992)
|
|---|
| 58 | +++ src/org/openstreetmap/josm/actions/DiskAccessAction.java (working copy)
|
|---|
| 59 | @@ -37,7 +37,7 @@
|
|---|
| 60 | FileFilter defaultFilter = null;
|
|---|
| 61 | for (FileImporter imExporter: ExtensionFileFilter.importers) {
|
|---|
| 62 | fc.addChoosableFileFilter(imExporter.filter);
|
|---|
| 63 | - if (imExporter.filter.defaultExtension.endsWith("osm")) {
|
|---|
| 64 | + if (imExporter instanceof ExtensionFileFilter.AllFormatsImporter) {
|
|---|
| 65 | defaultFilter = imExporter.filter;
|
|---|
| 66 | }
|
|---|
| 67 |
|
|---|
| 68 | Index: src/org/openstreetmap/josm/io/OsmBzip2Importer.java
|
|---|
| 69 | ===================================================================
|
|---|
| 70 | --- src/org/openstreetmap/josm/io/OsmBzip2Importer.java (revision 1992)
|
|---|
| 71 | +++ src/org/openstreetmap/josm/io/OsmBzip2Importer.java (working copy)
|
|---|
| 72 | @@ -15,7 +15,7 @@
|
|---|
| 73 | public class OsmBzip2Importer extends OsmImporter {
|
|---|
| 74 |
|
|---|
| 75 | public OsmBzip2Importer() {
|
|---|
| 76 | - super(new ExtensionFileFilter("osm.bz2, osm.bz", "osm.bz2", tr("OSM Server Files bzip2 compressed")
|
|---|
| 77 | + super(new ExtensionFileFilter("osm.bz2,osm.bz", "osm.bz2", tr("OSM Server Files bzip2 compressed")
|
|---|
| 78 | + " (*.osm.bz2 *.osm.bz)"));
|
|---|
| 79 | }
|
|---|
| 80 |
|
|---|