Changeset 14432 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2018-11-20T00:09:48+01:00 (6 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetDetailPanel.java
r14121 r14432 53 53 * This panel displays the properties of the currently selected changeset in the 54 54 * {@link ChangesetCacheManager}. 55 * 55 * @since 2689 56 56 */ 57 57 public class ChangesetDetailPanel extends JPanel implements PropertyChangeListener, ChangesetAware { … … 347 347 public void actionPerformed(ActionEvent evt) { 348 348 if (currentChangeset != null) 349 new OpenChangesetPopupMenu(currentChangeset.getId() ).show(btnOpenChangesetPopupMenu);349 new OpenChangesetPopupMenu(currentChangeset.getId(), null).show(btnOpenChangesetPopupMenu); 350 350 } 351 351 -
trunk/src/org/openstreetmap/josm/gui/history/OpenChangesetPopupMenu.java
r14248 r14432 10 10 import java.util.Arrays; 11 11 import java.util.List; 12 import java.util.Objects; 12 13 13 14 import javax.swing.AbstractAction; … … 18 19 import org.openstreetmap.josm.data.StructUtils; 19 20 import org.openstreetmap.josm.data.StructUtils.StructEntry; 21 import org.openstreetmap.josm.data.osm.PrimitiveId; 20 22 import org.openstreetmap.josm.spi.preferences.Config; 21 23 import org.openstreetmap.josm.tools.ImageProvider; … … 33 35 * 34 36 * @param changesetId the changeset id 37 * @param primitiveId the primitive id 38 * @since 14432 35 39 */ 36 public OpenChangesetPopupMenu(final long changesetId ) {40 public OpenChangesetPopupMenu(final long changesetId, final PrimitiveId primitiveId) { 37 41 StructUtils.getListOfStructs(Config.getPref(), "history-dialog.tools", DEFAULT_ENTRIES, ChangesetViewerEntry.class) 38 42 .stream() 39 .map(entry -> entry.toAction(changesetId)) 43 .map(entry -> entry.toAction(changesetId, primitiveId)) 44 .filter(Objects::nonNull) 40 45 .forEach(this::add); 41 46 } … … 58 63 new ChangesetViewerEntry(tr("Open {0}", "achavi (Augmented OSM Change Viewer)"), "https://overpass-api.de/achavi/?changeset={0}"), 59 64 new ChangesetViewerEntry(tr("Open {0}", "OSMCha (OSM Changeset Analyzer)"), "https://osmcha.mapbox.com/changesets/{0}"), 60 new ChangesetViewerEntry(tr("Open {0}", "OSM History Viewer"), "http://osmhv.openstreetmap.de/changeset.jsp?id={0}"), 65 new ChangesetViewerEntry(tr("Open {0}", "OSM History Viewer (osmrmhv)"), "http://osmhv.openstreetmap.de/changeset.jsp?id={0}"), 66 new ChangesetViewerEntry(tr("Open {0}", "OSM History Viewer (Pewu)"), "https://pewu.github.io/osm-history/#/{1}/{2}"), 61 67 new ChangesetViewerEntry(tr("Open {0}", "WhoDidIt (OSM Changeset Analyzer)"), 62 68 "http://simon04.dev.openstreetmap.org/whodidit/index.html?changeset={0}&show=1") … … 70 76 @StructEntry 71 77 public String name; 72 /** Templated service url. <code>{0}</code> will be replaced by changeset id */ 78 /** 79 * Templated service url. 80 * <code>{0}</code> will be replaced by changeset id 81 * <code>{1}</code> will be replaced by object type (node, way, relation) 82 * <code>{2}</code> will be replaced by object id 83 */ 73 84 @StructEntry 74 85 public String url; … … 81 92 82 93 ChangesetViewerEntry(String name, String url) { 83 this.name = name;84 this.url = url;94 this.name = Objects.requireNonNull(name); 95 this.url = Objects.requireNonNull(url); 85 96 } 86 97 87 Action toAction(final long changesetId) { 88 return new OpenBrowserAction(name, MessageFormat.format(this.url, Long.toString(changesetId))); 98 Action toAction(final long changesetId, PrimitiveId primitiveId) { 99 if (primitiveId != null) { 100 return new OpenBrowserAction(name, MessageFormat.format(url, 101 Long.toString(changesetId), primitiveId.getType().getAPIName(), Long.toString(primitiveId.getUniqueId()))); 102 } else if (url.contains("{0}")) { 103 return new OpenBrowserAction(name, MessageFormat.format(url, Long.toString(changesetId))); 104 } 105 return null; 89 106 } 90 107 } -
trunk/src/org/openstreetmap/josm/gui/history/VersionInfoPanel.java
r14273 r14432 29 29 import org.openstreetmap.josm.data.osm.Changeset; 30 30 import org.openstreetmap.josm.data.osm.OsmPrimitive; 31 import org.openstreetmap.josm.data.osm.PrimitiveId; 31 32 import org.openstreetmap.josm.data.osm.User; 32 33 import org.openstreetmap.josm.data.osm.history.HistoryOsmPrimitive; … … 68 69 private JTextArea texChangesetSource; 69 70 private JTextArea texChangesetImageryUsed; 71 private PrimitiveId primitiveId; 70 72 71 73 protected static JTextArea buildTextArea(String tooltip) { … … 117 119 arrowButton.addActionListener(action -> { 118 120 if (changesetDialogAction.id != null) { // fix #15444, #16097 119 final OpenChangesetPopupMenu popupMenu = new OpenChangesetPopupMenu(changesetDialogAction.id );121 final OpenChangesetPopupMenu popupMenu = new OpenChangesetPopupMenu(changesetDialogAction.id, primitiveId); 120 122 popupMenu.insert(changesetDialogAction, 0); 121 123 ((AbstractButton) popupMenu.getComponent(0)).setText(tr("Open Changeset Manager")); … … 223 225 if (primitive != null) { 224 226 Changeset cs = primitive.getChangeset(); 225 update(cs, model.isLatest(primitive), primitive.getTimestamp(), primitive.getVersion() );227 update(cs, model.isLatest(primitive), primitive.getTimestamp(), primitive.getVersion(), primitive.getPrimitiveId()); 226 228 } 227 229 } … … 233 235 */ 234 236 public void update(final OsmPrimitive primitive, final boolean isLatest) { 235 update(Changeset.fromPrimitive(primitive), isLatest, primitive.getTimestamp(), primitive.getVersion() );237 update(Changeset.fromPrimitive(primitive), isLatest, primitive.getTimestamp(), primitive.getVersion(), primitive.getPrimitiveId()); 236 238 } 237 239 … … 242 244 * @param timestamp the timestamp 243 245 * @param version the version of the primitive 246 * @param id the id and type of the primitive 247 * @since 14432 244 248 */ 245 public void update(final Changeset cs, final boolean isLatest, final Date timestamp, final long version ) {249 public void update(final Changeset cs, final boolean isLatest, final Date timestamp, final long version, final PrimitiveId id) { 246 250 lblInfo.setText(getInfoText(timestamp, version, isLatest)); 251 primitiveId = id; 247 252 248 253 if (!isLatest && cs != null) {
Note:
See TracChangeset
for help on using the changeset viewer.