Changeset 28975 in osm for applications/editors


Ignore:
Timestamp:
2012-11-24T23:46:58+01:00 (12 years ago)
Author:
simon04
Message:

JOSM/wikipedia: fix #josm8035: add {{location dec}} and {{object location dec}} templates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/wikipedia/src/org/wikipedia/WikipediaCopyTemplate.java

    r28465 r28975  
    44
    55import java.awt.event.ActionEvent;
     6import java.util.Arrays;
    67import java.util.Collection;
     8import java.util.List;
     9import javax.swing.JMenuItem;
    710import org.openstreetmap.josm.Main;
    811import org.openstreetmap.josm.actions.JosmAction;
     
    1417public class WikipediaCopyTemplate {
    1518
     19    private static final List<CoordCopyTemplate> TEMPLATES = Arrays.asList(
     20            new CoordCopyTemplate(tr("Copy {0} template", "{{Coordinate}}"), "wikipedia-coordinate", "{{Coordinate|NS={lat}|EW={lon}|type=landmark|region=}}"),
     21            new CoordCopyTemplate(tr("Copy {0} template", "{{Coord}}"), "wikipedia-coord", "{{Coord|{lat}|{lon}}}"),
     22            new CoordCopyTemplate(tr("Copy {0} template", "{{Location dec}}"), "wikipedia-location-dec", "{{Location dec|{lat}|{lon}}}"),
     23            new CoordCopyTemplate(tr("Copy {0} template", "{{Object location dec}}"), "wikipedia-object-location-dec", "{{Object location dec|{lat}|{lon}}}")
     24            );
     25
    1626    public WikipediaCopyTemplate() {
    17         final CoordCopyTemplate coord = new CoordCopyTemplate(
    18                 tr("Copy {0} template", "''{{Coord}}''"), "wikipedia-coord",
    19                 "{{Coord|{lat}|{lon}}}");
    20         final CoordCopyTemplate coordinate = new CoordCopyTemplate(
    21                 tr("Copy {0} template", "''{{Coordinate}}''"), "wikipedia-coordinate",
    22                 "{{Coordinate|NS={lat}|EW={lon}|type=landmark|region=}}");
    23         MainMenu.addAfter(Main.main.menu.editMenu, coord, false, Main.main.menu.copyCoordinates);
    24         MainMenu.addAfter(Main.main.menu.editMenu, coordinate, false, Main.main.menu.copyCoordinates);
     27        JosmAction previous = Main.main.menu.copyCoordinates;
     28        for (final CoordCopyTemplate t : TEMPLATES) {
     29            MainMenu.addAfter(Main.main.menu.editMenu, t, false, previous);
     30            previous = t;
     31            //MainMenu.addAfter(Main.main.menu.editMenu, coord, false, Main.main.menu.copyCoordinates);
     32        }
    2533    }
    2634
Note: See TracChangeset for help on using the changeset viewer.