Last change
on this file since 6491 was 1495, checked in by nick, 18 years ago |
New waypoint import plugin for JOSM
|
File size:
722 bytes
|
Line | |
---|
1 | package waypoints;
|
---|
2 |
|
---|
3 | import java.awt.Component;
|
---|
4 | import javax.swing.JMenuItem;
|
---|
5 | import javax.swing.JSeparator;
|
---|
6 |
|
---|
7 | import org.openstreetmap.josm.Main;
|
---|
8 | import org.openstreetmap.josm.plugins.Plugin;
|
---|
9 |
|
---|
10 | public class WaypointPlugin extends Plugin {
|
---|
11 |
|
---|
12 |
|
---|
13 | public WaypointPlugin() {
|
---|
14 | JMenuItem waypointItem = new JMenuItem(new WaypointOpenAction());
|
---|
15 | int index = findFirstSeparator();
|
---|
16 | Main.main.menu.fileMenu.add(waypointItem,index<0 ? 0: index);
|
---|
17 | }
|
---|
18 |
|
---|
19 | private int findFirstSeparator()
|
---|
20 | {
|
---|
21 | Component[] components = Main.main.menu.fileMenu.getMenuComponents();
|
---|
22 | for(int count=0; count<components.length; count++)
|
---|
23 | {
|
---|
24 | if(components[count] instanceof JSeparator)
|
---|
25 | return count;
|
---|
26 | }
|
---|
27 | return -1;
|
---|
28 | }
|
---|
29 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.