Ticket #17279: 17279.patch
File 17279.patch, 2.8 KB (added by , 6 years ago) |
---|
-
src/org/openstreetmap/josm/gui/history/HistoryLoadTask.java
52 52 private final Set<PrimitiveId> toLoad = new HashSet<>(); 53 53 private HistoryDataSet loadedData; 54 54 private OsmServerHistoryReader reader; 55 private boolean getChangesetData = true; 55 56 56 57 /** 57 58 * Constructs a new {@code HistoryLoadTask}. … … 163 164 @Override 164 165 protected void realRun() throws SAXException, IOException, OsmTransferException { 165 166 loadedData = new HistoryDataSet(); 167 int ticks = toLoad.size(); 168 if (getChangesetData) 169 ticks *= 2; 166 170 try { 167 progressMonitor.setTicksCount( 2 * toLoad.size());171 progressMonitor.setTicksCount(ticks); 168 172 for (PrimitiveId pid: toLoad) { 169 173 if (canceled) { 170 174 break; … … 183 187 HistoryDataSet ds; 184 188 try { 185 189 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 } 187 195 } catch (OsmTransferException e) { 188 196 if (canceled) 189 197 return; … … 240 248 public Exception getLastException() { 241 249 return lastException; 242 250 } 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 } 243 259 } -
src/org/openstreetmap/josm/io/OsmServerHistoryReader.java
59 59 public HistoryDataSet parseHistory(ProgressMonitor progressMonitor) throws OsmTransferException { 60 60 progressMonitor.beginTask(""); 61 61 try { 62 progressMonitor.indeterminateSubTask(tr("Contacting OSM Server..."));63 62 final String urlStr = primitiveType.getAPIName() + '/' + id + "/history"; 63 progressMonitor.indeterminateSubTask(tr("Contacting OSM Server for {0}", urlStr)); 64 64 65 65 try (InputStream in = getInputStream(urlStr, progressMonitor.createSubTaskMonitor(1, true))) { 66 66 if (in == null)