Ticket #12369: DefaultExtensionReadFromPreferences.patch

File DefaultExtensionReadFromPreferences.patch, 3.9 KB (added by kolesar, 6 years ago)
  • src/org/openstreetmap/josm/actions/GpxExportAction.java

    diff --git a/src/org/openstreetmap/josm/actions/GpxExportAction.java b/src/org/openstreetmap/josm/actions/GpxExportAction.java
    index 237ce17..50a16d5 100644
    a b public class GpxExportAction extends DiskAccessAction { 
    8282            throw new IllegalArgumentException(MessageFormat.format("Expected instance of OsmDataLayer or GpxLayer. Got ''{0}''.",
    8383                    layer.getClass().getName()));
    8484
    85         File file = createAndOpenSaveFileChooser(tr("Export GPX file"), GpxImporter.FILE_FILTER);
     85        File file = createAndOpenSaveFileChooser(tr("Export GPX file"), GpxImporter.getFileFilter());
    8686        if (file == null)
    8787            return;
    8888
  • src/org/openstreetmap/josm/gui/layer/GpxLayer.java

    diff --git a/src/org/openstreetmap/josm/gui/layer/GpxLayer.java b/src/org/openstreetmap/josm/gui/layer/GpxLayer.java
    index 908320f..6c54410 100644
    a b public class GpxLayer extends Layer { 
    362362
    363363    @Override
    364364    public File createAndOpenSaveFileChooser() {
    365         return SaveActionBase.createAndOpenSaveFileChooser(tr("Save GPX file"), GpxImporter.FILE_FILTER);
     365        return SaveActionBase.createAndOpenSaveFileChooser(tr("Save GPX file"), GpxImporter.getFileFilter());
    366366    }
    367367
    368368}
  • src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java

    diff --git a/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java b/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
    index 55a5f63..391e5c2 100644
    a b public class OsmDataLayer extends AbstractModifiableLayer implements Listener, S 
    964964
    965965    @Override
    966966    public File createAndOpenSaveFileChooser() {
    967         return SaveActionBase.createAndOpenSaveFileChooser(tr("Save OSM file"), "osm");
     967        String extension = Main.pref.get("save.extension.osm", "osm");
     968        return SaveActionBase.createAndOpenSaveFileChooser(tr("Save OSM file"), extension);
    968969    }
    969970
    970971    @Override
  • src/org/openstreetmap/josm/io/GpxExporter.java

    diff --git a/src/org/openstreetmap/josm/io/GpxExporter.java b/src/org/openstreetmap/josm/io/GpxExporter.java
    index 3da86ff..0825eee 100644
    a b public class GpxExporter extends FileExporter implements GpxConstants { 
    6262     * Constructs a new {@code GpxExporter}.
    6363     */
    6464    public GpxExporter() {
    65         super(GpxImporter.FILE_FILTER);
     65        super(GpxImporter.getFileFilter());
    6666    }
    6767
    6868    @Override
  • src/org/openstreetmap/josm/io/GpxImporter.java

    diff --git a/src/org/openstreetmap/josm/io/GpxImporter.java b/src/org/openstreetmap/josm/io/GpxImporter.java
    index f7a400e..b79cce5 100644
    a b import org.xml.sax.SAXException; 
    2525public class GpxImporter extends FileImporter {
    2626
    2727    /**
    28      * The GPX file filter (*.gpx and *.gpx.gz files).
    29      */
    30     public static final ExtensionFileFilter FILE_FILTER = ExtensionFileFilter.newFilterWithArchiveExtensions(
    31             "gpx", "gpx", tr("GPX Files"), true);
    32 
    33     /**
    3428     * Utility class containing imported GPX and marker layers, and a task to run after they are added to MapView.
    3529     */
    3630    public static class GpxImporterData {
    public class GpxImporter extends FileImporter { 
    7064     * Constructs a new {@code GpxImporter}.
    7165     */
    7266    public GpxImporter() {
    73         super(FILE_FILTER);
     67        super(getFileFilter());
     68    }
     69
     70    /**
     71     * Returns a GPX file filter (*.gpx and *.gpx.gz files).
     72     */
     73    public static ExtensionFileFilter getFileFilter() {
     74        return ExtensionFileFilter.newFilterWithArchiveExtensions(
     75            "gpx", Main.pref.get("save.extension.gpx", "gpx"), tr("GPX Files"), true);
    7476    }
    7577
    7678    @Override