Changeset 10 in josm for src/org/openstreetmap/josm/actions
- Timestamp:
- 2005-10-04T20:14:54+02:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/actions/SaveGpxAction.java
r1 r10 4 4 import java.awt.event.KeyEvent; 5 5 import java.io.File; 6 import java.io.FileWriter; 7 import java.io.IOException; 6 8 7 9 import javax.swing.AbstractAction; 8 10 import javax.swing.ImageIcon; 9 11 import javax.swing.JFileChooser; 12 import javax.swing.JOptionPane; 10 13 11 14 import org.openstreetmap.josm.gui.Main; 15 import org.openstreetmap.josm.io.GpxWriter; 12 16 13 17 /** … … 29 33 30 34 @SuppressWarnings("unchecked") 31 public void actionPerformed(ActionEvent e) { 35 public void actionPerformed(ActionEvent event) { 36 if (Main.main.getMapFrame() == null) { 37 JOptionPane.showMessageDialog(Main.main, "No document open so nothing to save."); 38 return; 39 } 32 40 JFileChooser fc = new JFileChooser("data"); 33 41 fc.showSaveDialog(Main.main); … … 35 43 if (gpxFile == null) 36 44 return; 45 46 try { 47 FileWriter fileWriter = new FileWriter(gpxFile); 48 GpxWriter out = new GpxWriter(fileWriter, Main.main.getMapFrame().mapView.dataSet); 49 out.output(); 50 fileWriter.close(); 51 } catch (IOException e) { 52 e.printStackTrace(); 53 JOptionPane.showMessageDialog(Main.main, "An error occoured while saving.\n"+e.getMessage()); 54 } 37 55 } 38 56
Note:
See TracChangeset
for help on using the changeset viewer.
