Changeset 6815 in josm


Ignore:
Timestamp:
2014-02-06T00:03:52+01:00 (11 years ago)
Author:
Don-vip
Message:

fix #9662 - correct handling of canceled gpx export

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

Legend:

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

    r6643 r6815  
    6868        try {
    6969            boolean exported = false;
     70            boolean canceled = false;
    7071            for (FileExporter exporter : ExtensionFileFilter.exporters) {
    7172                if (exporter.acceptFile(file, layer)) {
    7273                    exporter.exportData(file, layer);
    7374                    exported = true;
     75                    canceled = exporter.isCanceled();
    7476                    break;
    7577                }
     
    7880                JOptionPane.showMessageDialog(Main.parent, tr("No Exporter found! Nothing saved."), tr("Warning"),
    7981                        JOptionPane.WARNING_MESSAGE);
     82                return false;
     83            } else if (canceled) {
    8084                return false;
    8185            }
  • trunk/src/org/openstreetmap/josm/io/FileExporter.java

    r6070 r6815  
    1616
    1717    private boolean enabled;
     18    private boolean canceled;
    1819
     20    /**
     21     * Constructs a new {@code FileExporter}.
     22     * @param filter The extension file filter
     23     */
    1924    public FileExporter(ExtensionFileFilter filter) {
    2025        this.filter = filter;
     
    6267        // To be overriden by subclasses if needed
    6368    }
     69
     70    /**
     71     * Determines if this exporter has been canceled during export.
     72     * @return true if this {@code FileExporter} has been canceled
     73     * @since 6815
     74     */
     75    public final boolean isCanceled() {
     76        return canceled;
     77    }
     78
     79    /**
     80     * Marks this exporter as canceled.
     81     * @param canceled true to mark this exporter as canceled, {@code false} otherwise
     82     * @since 6815
     83     */
     84    public final void setCanceled(boolean canceled) {
     85        this.canceled = canceled;
     86    }
    6487}
  • trunk/src/org/openstreetmap/josm/io/GpxExporter.java

    r6716 r6815  
    127127        ed.showDialog();
    128128
    129         if (ed.getValue() != 1)
     129        if (ed.getValue() != 1) {
     130            setCanceled(true);
    130131            return;
     132        }
     133        setCanceled(false);
    131134
    132135        Main.pref.put("lastAddAuthor", author.isSelected());
Note: See TracChangeset for help on using the changeset viewer.