source: osm/applications/editors/josm/plugins/scripting/scripts/HelloWorld.js@ 25107

Last change on this file since 25107 was 25083, checked in by guggis, 14 years ago

Updated sample scripts

File size: 521 bytes
Line 
1/*
2* HelloWorld.js - displays the number of actually open layers
3*/
4importClass(Packages.javax.swing.JOptionPane)
5importClass(Packages.org.openstreetmap.josm.Main)
6
7function getMapView() {
8 if (Main.main == null) return null
9 if (Main.main.map == null) return null
10 return Main.main.map.mapView
11}
12
13var numlayers = 0
14var mv = getMapView()
15if (mv != null){
16 numlayers = mv.getNumLayers()
17}
18JOptionPane.showMessageDialog(Main.parent, "[JavaScript] Hello World! You have " + numlayers + " layer(s).")
19
Note: See TracBrowser for help on using the repository browser.