| Line | |
|---|
| 1 | package nanolog;
|
|---|
| 2 |
|
|---|
| 3 | import java.awt.event.ActionEvent;
|
|---|
| 4 | import javax.swing.JFileChooser;
|
|---|
| 5 | import org.openstreetmap.josm.Main;
|
|---|
| 6 | import org.openstreetmap.josm.actions.JosmAction;
|
|---|
| 7 | import org.openstreetmap.josm.gui.MapFrame;
|
|---|
| 8 | import org.openstreetmap.josm.plugins.Plugin;
|
|---|
| 9 | import org.openstreetmap.josm.plugins.PluginInformation;
|
|---|
| 10 | import static org.openstreetmap.josm.tools.I18n.tr;
|
|---|
| 11 |
|
|---|
| 12 | /**
|
|---|
| 13 | * Add NanoLog opening menu item and the panel.
|
|---|
| 14 | *
|
|---|
| 15 | * @author zverik
|
|---|
| 16 | */
|
|---|
| 17 | public 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.