source: osm/applications/editors/josm/plugins/NanoLog/src/nanolog/NanoLogPlugin.java@ 27939

Last change on this file since 27939 was 27939, checked in by zverik, 13 years ago

NanoLog plugin

File size: 1.3 KB
Line 
1package nanolog;
2
3import java.awt.event.ActionEvent;
4import javax.swing.JFileChooser;
5import org.openstreetmap.josm.Main;
6import org.openstreetmap.josm.actions.JosmAction;
7import org.openstreetmap.josm.gui.MapFrame;
8import org.openstreetmap.josm.plugins.Plugin;
9import org.openstreetmap.josm.plugins.PluginInformation;
10import static org.openstreetmap.josm.tools.I18n.tr;
11
12/**
13 * Add NanoLog opening menu item and the panel.
14 *
15 * @author zverik
16 */
17public class NanoLogPlugin extends Plugin {
18 public NanoLogPlugin( PluginInformation info ) {
19 super(info);
20 Main.main.menu.fileMenu.add(new OpenNanoLogLayerAction());
21 }
22
23 @Override
24 public void mapFrameInitialized( MapFrame oldFrame, MapFrame newFrame ) {
25 if( oldFrame == null && newFrame != null ) {
26 newFrame.addToggleDialog(new NanoLogPanel());
27 }
28 }
29
30 private class OpenNanoLogLayerAction extends JosmAction {
31
32 public OpenNanoLogLayerAction() {
33 super(tr("Open NanoLog file..."), "nanolog.png", tr("Open NanoLog file..."), null, false);
34 }
35
36 public void actionPerformed( ActionEvent e ) {
37 JFileChooser fc = new JFileChooser();
38 if( fc.showOpenDialog(Main.parent) == JFileChooser.APPROVE_OPTION ) {
39 // open layer, ok
40 }
41 }
42 }
43}
Note: See TracBrowser for help on using the repository browser.