Changeset 4393 in josm for trunk/src/org/openstreetmap


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

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

Legend:

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

    r4371 r4393  
    284284            if (importer.isBatchImporter()) {
    285285                if (canceled) return;
    286                 String msg;
    287                 if (files.size() == 1) {
    288                     msg = tr("Opening 1 file...");
    289                 } else {
    290                     msg = trn("Opening {0} file...", "Opening {0} files...", files.size(), files.size());
    291                 }
     286                String msg = trn("Opening {0} file...", "Opening {0} files...", files.size(), files.size());
    292287                getProgressMonitor().setCustomText(msg);
    293288                getProgressMonitor().indeterminateSubTask(msg);
  • 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.