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.data.osm.IPrimitive; 010import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 011import org.openstreetmap.josm.spi.preferences.Config; 012import org.openstreetmap.josm.tools.Shortcut; 013 014/** 015 * Display history information about OSM ways, nodes, or relations in web browser. 016 * @since 4408 017 */ 018public class HistoryInfoWebAction extends AbstractInfoAction { 019 020 /** 021 * Constructs a new {@code HistoryInfoWebAction}. 022 */ 023 public HistoryInfoWebAction() { 024 super(tr("History (web)"), "dialogs/history", 025 tr("Display history information about OSM ways, nodes, or relations in web browser."), 026 Shortcut.registerShortcut("core:historyinfoweb", 027 tr("History (web)"), KeyEvent.VK_H, Shortcut.CTRL_SHIFT), 028 true, "action/historyinfoweb", true); 029 setHelpId(ht("/Action/ObjectHistoryWeb")); 030 } 031 032 @Override 033 protected String createInfoUrl(Object infoObject) { 034 if (infoObject instanceof IPrimitive) { 035 IPrimitive primitive = (IPrimitive) infoObject; 036 return Config.getUrls().getBaseBrowseUrl() 037 + '/' + OsmPrimitiveType.from(primitive).getAPIName() + '/' + primitive.getOsmId() + "/history"; 038 } else { 039 return null; 040 } 041 } 042}