001//License: GPL. For details, see LICENSE file.
002package org.openstreetmap.josm.actions;
003
004import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
005import static org.openstreetmap.josm.tools.I18n.tr;
006
007import java.awt.event.KeyEvent;
008
009import org.openstreetmap.josm.Main;
010import org.openstreetmap.josm.data.osm.OsmPrimitive;
011import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
012import org.openstreetmap.josm.tools.Shortcut;
013
014/**
015 * Display object information about OSM nodes, ways, or relations in web browser.
016 * @since 4408
017 */
018public class InfoWebAction extends AbstractInfoAction {
019
020    /**
021     * Constructs a new {@code InfoWebAction}.
022     */
023    public InfoWebAction() {
024        super(tr("Advanced info (web)"), "info",
025                tr("Display object information about OSM nodes, ways, or relations in web browser."),
026                Shortcut.registerShortcut("core:infoweb",
027                        tr("Advanced info (web)"), KeyEvent.VK_I, Shortcut.CTRL_SHIFT),
028                true, "action/infoweb", true);
029        putValue("help", ht("/Action/InfoAboutElementsWeb"));
030    }
031
032    @Override
033    protected  String createInfoUrl(Object infoObject) {
034        OsmPrimitive primitive = (OsmPrimitive)infoObject;
035        return Main.getBaseBrowseUrl() + "/" + OsmPrimitiveType.from(primitive).getAPIName() + "/" + primitive.getId();
036    }
037}