Changeset 32638 in osm for applications/editors/josm/plugins/NanoLog/src/nanolog/NanoLogPlugin.java
- Timestamp:
- 2016-07-11T23:01:43+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/NanoLog/src/nanolog/NanoLogPlugin.java
r32447 r32638 18 18 /** 19 19 * Add NanoLog opening menu item and the panel. 20 * 20 * 21 21 * @author zverik 22 22 */ 23 23 public class NanoLogPlugin extends Plugin { 24 public NanoLogPlugin( PluginInformation info) {24 public NanoLogPlugin(PluginInformation info) { 25 25 super(info); 26 26 Main.main.menu.fileMenu.insert(new OpenNanoLogLayerAction(), 4); 27 27 } 28 28 29 29 @Override 30 public void mapFrameInitialized( MapFrame oldFrame, MapFrame newFrame) {31 if (oldFrame == null && newFrame != null) {30 public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) { 31 if (oldFrame == null && newFrame != null) { 32 32 NanoLogPanel panel = new NanoLogPanel(); 33 33 newFrame.addToggleDialog(panel); … … 35 35 } 36 36 } 37 37 38 38 private class OpenNanoLogLayerAction extends JosmAction { 39 39 40 publicOpenNanoLogLayerAction() {40 OpenNanoLogLayerAction() { 41 41 super(tr("Open NanoLog file..."), "nanolog.png", tr("Open NanoLog file..."), null, false); 42 42 } 43 43 44 public void actionPerformed( ActionEvent e ) { 44 @Override 45 public void actionPerformed(ActionEvent e) { 45 46 JFileChooser fc = new JFileChooser(); 46 if (fc.showOpenDialog(Main.parent) == JFileChooser.APPROVE_OPTION) {47 if (fc.showOpenDialog(Main.parent) == JFileChooser.APPROVE_OPTION) { 47 48 try { 48 49 List<NanoLogEntry> entries = NanoLogLayer.readNanoLog(fc.getSelectedFile()); 49 if (!entries.isEmpty()) {50 if (!entries.isEmpty()) { 50 51 NanoLogLayer layer = new NanoLogLayer(entries); 51 52 Main.getLayerManager().addLayer(layer); 52 53 layer.setupListeners(); 53 54 } 54 } catch (IOException ex) {55 } catch (IOException ex) { 55 56 JOptionPane.showMessageDialog(Main.parent, tr("Could not read NanoLog file:") + "\n" + ex.getMessage()); 56 57 } 57 58 } 58 } 59 } 59 60 } 60 61 }
Note:
See TracChangeset
for help on using the changeset viewer.
