| 1 | // License: GPL. For details, see LICENSE file.
|
|---|
| 2 | package org.openstreetmap.josm.actions;
|
|---|
| 3 |
|
|---|
| 4 | import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
|
|---|
| 5 | import static org.openstreetmap.josm.tools.I18n.tr;
|
|---|
| 6 |
|
|---|
| 7 | import java.awt.event.KeyEvent;
|
|---|
| 8 |
|
|---|
| 9 | import org.openstreetmap.josm.data.osm.IPrimitive;
|
|---|
| 10 | import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
|
|---|
| 11 | import org.openstreetmap.josm.spi.preferences.Config;
|
|---|
| 12 | import org.openstreetmap.josm.tools.Shortcut;
|
|---|
| 13 |
|
|---|
| 14 | /**
|
|---|
| 15 | * Display history information about OSM ways, nodes, or relations in web browser.
|
|---|
| 16 | * @since 4408
|
|---|
| 17 | */
|
|---|
| 18 | public class HistoryInfoWebAction extends AbstractInfoAction {
|
|---|
| 19 |
|
|---|
| 20 | /**
|
|---|
| 21 | * Constructs a new {@code HistoryInfoWebAction}.
|
|---|
| 22 | */
|
|---|
| 23 | public HistoryInfoWebAction() {
|
|---|
| 24 | super(tr("History (web)"), "dialogs/history",
|
|---|
| 25 | tr("Display history information about OSM ways, nodes, or relations in web browser."),
|
|---|
| 26 | Shortcut.registerShortcut("core:historyinfoweb",
|
|---|
| 27 | tr("View: {0}", tr("History (web)")), KeyEvent.VK_H, Shortcut.CTRL_SHIFT),
|
|---|
| 28 | true, "action/historyinfoweb", true);
|
|---|
| 29 | setHelpId(ht("/Action/ObjectHistoryWeb"));
|
|---|
| 30 | }
|
|---|
| 31 |
|
|---|
| 32 | @Override
|
|---|
| 33 | protected String createInfoUrl(Object infoObject) {
|
|---|
| 34 | if (infoObject instanceof IPrimitive) {
|
|---|
| 35 | IPrimitive primitive = (IPrimitive) infoObject;
|
|---|
| 36 | return Config.getUrls().getBaseBrowseUrl()
|
|---|
| 37 | + '/' + OsmPrimitiveType.from(primitive).getAPIName() + '/' + primitive.getOsmId() + "/history";
|
|---|
| 38 | } else {
|
|---|
| 39 | return null;
|
|---|
| 40 | }
|
|---|
| 41 | }
|
|---|
| 42 | }
|
|---|