Changeset 16694 in josm


Ignore:
Timestamp:
2020-06-21T12:16:35+02:00 (3 weeks ago)
Author:
simon04
Message:

see #19367 - History browser: do not reset UI after (re)loading of history (version table)

Location:
trunk/src/org/openstreetmap/josm/gui/history
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowser.java

    r16591 r16694  
    77import java.awt.Dimension;
    88import java.util.Arrays;
    9 import java.util.Objects;
    109
    1110import javax.swing.JPanel;
     
    115114     */
    116115    public void populate(History history) {
    117         boolean samePrimitive = model.getHistory() != null && Objects.equals(model.getHistory().getPrimitiveId(), history.getPrimitiveId());
     116        boolean samePrimitive = model.isSamePrimitive(history); // needs to be before setHistory
    118117        model.setHistory(history);
    119118        if (samePrimitive) {
  • trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserModel.java

    r14273 r16694  
    55
    66import java.util.HashSet;
     7import java.util.Objects;
    78import java.util.Set;
    89
     
    128129    }
    129130
     131    boolean isSamePrimitive(History history) {
     132        return getHistory() != null && Objects.equals(getHistory().getPrimitiveId(), history.getPrimitiveId());
     133    }
     134
    130135    private boolean canShowAsLatest(OsmPrimitive primitive) {
    131136        if (primitive == null)
     
    164169     */
    165170    public void setHistory(History history) {
     171        boolean samePrimitive = isSamePrimitive(history); // needs to be before `this.history = history`
    166172        this.history = history;
    167         if (history.getNumVersions() > 0) {
     173        if (samePrimitive && history.getNumVersions() > 0) {
     174            reference = history.getByVersion(reference.getVersion());
     175            current = history.getByVersion(current.getVersion());
     176        } else if (history.getNumVersions() > 0) {
    168177            HistoryOsmPrimitive newLatest = null;
    169178            DataSet ds = MainApplication.getLayerManager().getActiveDataSet();
Note: See TracChangeset for help on using the changeset viewer.