Ticket #17279: 17279.patch

File 17279.patch, 2.8 KB (added by GerdP, 6 years ago)
  • src/org/openstreetmap/josm/gui/history/HistoryLoadTask.java

     
    5252    private final Set<PrimitiveId> toLoad = new HashSet<>();
    5353    private HistoryDataSet loadedData;
    5454    private OsmServerHistoryReader reader;
     55    private boolean getChangesetData = true;
    5556
    5657    /**
    5758     * Constructs a new {@code HistoryLoadTask}.
     
    163164    @Override
    164165    protected void realRun() throws SAXException, IOException, OsmTransferException {
    165166        loadedData = new HistoryDataSet();
     167        int ticks = toLoad.size();
     168        if (getChangesetData)
     169            ticks *= 2;
    166170        try {
    167             progressMonitor.setTicksCount(2 * toLoad.size());
     171            progressMonitor.setTicksCount(ticks);
    168172            for (PrimitiveId pid: toLoad) {
    169173                if (canceled) {
    170174                    break;
     
    183187        HistoryDataSet ds;
    184188        try {
    185189            reader = new OsmServerHistoryReader(pid.getType(), pid.getUniqueId());
    186             ds = loadHistory(reader, progressMonitor);
     190            if (getChangesetData) {
     191                ds = loadHistory(reader, progressMonitor);
     192            } else {
     193                ds = reader.parseHistory(progressMonitor.createSubTaskMonitor(1, false));
     194            }
    187195        } catch (OsmTransferException e) {
    188196            if (canceled)
    189197                return;
     
    240248    public Exception getLastException() {
    241249        return lastException;
    242250    }
     251
     252    /**
     253     * Determine if changeset information is needed. By default it is retrieved.
     254     * @param b false means don't retrieve changeset data.
     255     */
     256    public void setChangesetDataNeeded(boolean b) {
     257        getChangesetData = b;
     258    }
    243259}
  • src/org/openstreetmap/josm/io/OsmServerHistoryReader.java

     
    5959    public HistoryDataSet parseHistory(ProgressMonitor progressMonitor) throws OsmTransferException {
    6060        progressMonitor.beginTask("");
    6161        try {
    62             progressMonitor.indeterminateSubTask(tr("Contacting OSM Server..."));
    6362            final String urlStr = primitiveType.getAPIName() + '/' + id + "/history";
     63            progressMonitor.indeterminateSubTask(tr("Contacting OSM Server for {0}", urlStr));
    6464
    6565            try (InputStream in = getInputStream(urlStr, progressMonitor.createSubTaskMonitor(1, true))) {
    6666                if (in == null)