Ticket #7215: MapkiHistory.patch

File MapkiHistory.patch, 2.9 KB (added by Cobra, 14 years ago)
  • src/org/openstreetmap/josm/actions/HistoryInfoMapkiAction.java

     
     1// License: GPL. For details, see LICENSE file.
     2package org.openstreetmap.josm.actions;
     3
     4import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
     5import static org.openstreetmap.josm.tools.I18n.tr;
     6
     7import java.awt.event.KeyEvent;
     8
     9import org.openstreetmap.josm.Main;
     10import org.openstreetmap.josm.data.osm.OsmPrimitive;
     11import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
     12import org.openstreetmap.josm.tools.Shortcut;
     13
     14public class HistoryInfoMapkiAction extends AbstractInfoAction {
     15
     16    public HistoryInfoMapkiAction() {
     17        super(tr("History (mapki/web)"), "about",
     18                tr("Display history information about OSM ways, nodes, or relations with the mapki service in web browser."),
     19                Shortcut.registerShortcut("core:historyinfomapki",
     20                        tr("History (mapki/web)"), KeyEvent.VK_H, Shortcut.GROUP_HOTKEY, Shortcut.SHIFT_DEFAULT), false);
     21        putValue("help", ht("/Action/ObjectHistoryMapki"));
     22        putValue("toolbar", "action/historyinfomapki");
     23        Main.toolbar.register(this);
     24    }
     25
     26    @Override
     27    protected String createInfoUrl(Object infoObject) {
     28        OsmPrimitive primitive = (OsmPrimitive) infoObject;
     29        return "http://osm.mapki.com/history/" + OsmPrimitiveType.from(primitive).getAPIName() + ".php?id=" + primitive.getId();
     30    }
     31
     32}
  • src/org/openstreetmap/josm/gui/MainMenu.java

     
    4343import org.openstreetmap.josm.actions.GpxExportAction;
    4444import org.openstreetmap.josm.actions.HelpAction;
    4545import org.openstreetmap.josm.actions.HistoryInfoAction;
     46import org.openstreetmap.josm.actions.HistoryInfoMapkiAction;
    4647import org.openstreetmap.josm.actions.HistoryInfoWebAction;
    4748import org.openstreetmap.josm.actions.InfoAction;
    4849import org.openstreetmap.josm.actions.InfoWebAction;
     
    157158    public final InfoWebAction infoweb = new InfoWebAction();
    158159    public final HistoryInfoAction historyinfo = new HistoryInfoAction();
    159160    public final HistoryInfoWebAction historyinfoweb = new HistoryInfoWebAction();
     161    public final HistoryInfoMapkiAction historyinfomapki = new HistoryInfoMapkiAction();
    160162
    161163    /* Tools menu */
    162164    public final JosmAction splitWay = new SplitWayAction();
     
    445447        add(viewMenu, infoweb);
    446448        add(viewMenu, historyinfo);
    447449                add(viewMenu, historyinfoweb);
     450        add(viewMenu, historyinfomapki);
    448451
    449452        add(presetsMenu, presetSearchAction);
    450453        presetsMenu.addSeparator();