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


Ignore:
Timestamp:
2010-05-29T21:12:42+02:00 (14 years ago)
Author:
stoecker
Message:

fix #5076 - exception for object download

File:
1 edited

Legend:

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

    r3224 r3285  
    1212import javax.swing.JCheckBox;
    1313import javax.swing.JLabel;
     14import javax.swing.JOptionPane;
    1415import javax.swing.JPanel;
    1516import javax.swing.KeyStroke;
     
    8687        dialog.setDefaultButton(1);
    8788        dialog.configureContextsensitiveHelp("/Action/DownloadObject", true /* show help button */);
     89        cbType.setSelectedIndex(Main.pref.getInteger("downloadprimitive.lasttype", 0));
    8890        dialog.showDialog();
    8991        if (dialog.getValue() != 1) return;
     92        Main.pref.putInteger("downloadprimitive.lasttype", cbType.getSelectedIndex());
    9093        Main.pref.put("downloadprimitive.referrers", referrers.isSelected());
    9194        Main.pref.put("download.newlayer", layer.isSelected());
    92         download(layer.isSelected(), cbType.getType(), tfId.getOsmId(), referrers.isSelected());
     95        int id = tfId.getOsmId();
     96        if(id <= 0)
     97            JOptionPane.showMessageDialog(
     98                    Main.parent,
     99                    tr("Invalid ID specified. Cannot download object."),
     100                    tr("Information"),
     101                    JOptionPane.INFORMATION_MESSAGE
     102            );
     103        else
     104            download(layer.isSelected(), cbType.getType(), id, referrers.isSelected());
    93105    }
    94106
Note: See TracChangeset for help on using the changeset viewer.