Ignore:
Timestamp:
2011-09-01T11:00:02+02:00 (13 years ago)
Author:
simon04
Message:

fix #5471 - information dialog when opening an empty osm file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/OsmImporter.java

    r3225 r4393  
    1010import java.io.InputStream;
    1111
     12import javax.swing.JOptionPane;
    1213import javax.swing.SwingUtilities;
    1314
     
    3940    }
    4041
    41     protected void importData(InputStream in, File associatedFile) throws IllegalDataException {
    42         DataSet dataSet = OsmReader.parseDataSet(in, NullProgressMonitor.INSTANCE);
     42    protected void importData(InputStream in, final File associatedFile) throws IllegalDataException {
     43        final DataSet dataSet = OsmReader.parseDataSet(in, NullProgressMonitor.INSTANCE);
    4344        final OsmDataLayer layer = new OsmDataLayer(dataSet, associatedFile.getName(), associatedFile);
    4445        // FIXME: remove UI stuff from IO subsystem
    4546        //
    4647        Runnable uiStuff = new Runnable() {
     48            @Override
    4749            public void run() {
     50                if (dataSet.allPrimitives().isEmpty()) {
     51                    JOptionPane.showMessageDialog(
     52                            Main.parent,
     53                            tr("No data found in file {0}.", associatedFile.getPath()),
     54                            tr("Open OSM file"),
     55                            JOptionPane.INFORMATION_MESSAGE);
     56                }
    4857                Main.main.addLayer(layer);
    4958                layer.onPostLoadFromFile();
Note: See TracChangeset for help on using the changeset viewer.