Changeset 30491 in osm for applications/editors/josm/plugins/NanoLog/src/nanolog/NanoLogPlugin.java
- Timestamp:
- 2014-06-10T00:04:18+02:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/NanoLog/src/nanolog/NanoLogPlugin.java
r27939 r30491 2 2 3 3 import java.awt.event.ActionEvent; 4 import java.io.IOException; 5 import java.util.List; 4 6 import javax.swing.JFileChooser; 7 import javax.swing.JOptionPane; 5 8 import org.openstreetmap.josm.Main; 6 9 import org.openstreetmap.josm.actions.JosmAction; 7 10 import org.openstreetmap.josm.gui.MapFrame; 11 import org.openstreetmap.josm.gui.MapView; 8 12 import org.openstreetmap.josm.plugins.Plugin; 9 13 import org.openstreetmap.josm.plugins.PluginInformation; … … 18 22 public NanoLogPlugin( PluginInformation info ) { 19 23 super(info); 20 Main.main.menu.fileMenu. add(new OpenNanoLogLayerAction());24 Main.main.menu.fileMenu.insert(new OpenNanoLogLayerAction(), 4); 21 25 } 22 26 … … 24 28 public void mapFrameInitialized( MapFrame oldFrame, MapFrame newFrame ) { 25 29 if( oldFrame == null && newFrame != null ) { 26 newFrame.addToggleDialog(new NanoLogPanel()); 30 NanoLogPanel panel = new NanoLogPanel(); 31 newFrame.addToggleDialog(panel); 32 MapView.addLayerChangeListener(panel); 27 33 } 28 34 } … … 37 43 JFileChooser fc = new JFileChooser(); 38 44 if( fc.showOpenDialog(Main.parent) == JFileChooser.APPROVE_OPTION ) { 39 // open layer, ok 45 try { 46 List<NanoLogEntry> entries = NanoLogLayer.readNanoLog(fc.getSelectedFile()); 47 if( !entries.isEmpty() ) { 48 NanoLogLayer layer = new NanoLogLayer(entries); 49 Main.main.addLayer(layer); 50 } 51 } catch( IOException ex ) { 52 JOptionPane.showMessageDialog(Main.parent, tr("Could not read NanoLog file:") + "\n" + ex.getMessage()); 53 } 40 54 } 41 55 }
Note:
See TracChangeset
for help on using the changeset viewer.