Changeset 35638 in osm for applications/editors/josm/plugins/reverter/src
- Timestamp:
- 2020-11-05T15:23:26+01:00 (4 years ago)
- Location:
- applications/editors/josm/plugins/reverter/src/reverter
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/reverter/src/reverter/OsmServerMultiObjectReader.java
r35382 r35638 43 43 } 44 44 } 45 private List<String> makeQueryStrings(OsmPrimitiveType type, Map<Long,Integer> list) {45 private static List<String> makeQueryStrings(OsmPrimitiveType type, Map<Long,Integer> list) { 46 46 List<String> result = new ArrayList<>((list.size()+maxQueryIds-1)/maxQueryIds); 47 47 StringBuilder sb = new StringBuilder(); … … 73 73 74 74 protected static final int maxQueryIds = 128; 75 public void readMultiObjects(OsmPrimitiveType type, Map<Long,Integer> list, ProgressMonitor progressMonitor) {75 public void readMultiObjects(OsmPrimitiveType type, Map<Long,Integer> list, ProgressMonitor progressMonitor) throws OsmTransferException { 76 76 for (String query : makeQueryStrings(type,list)) { 77 77 if (progressMonitor.isCanceled()) { 78 78 return; 79 79 } 80 rdr.callback = new ParseCallback() { 81 @Override 82 public void primitiveParsed(PrimitiveId id) { 83 if (id.getType() == type && list.remove(id.getUniqueId()) != null) { 84 progressMonitor.worked(1); 85 } 80 rdr.callback = id -> { 81 if (id.getType() == type && list.remove(id.getUniqueId()) != null) { 82 progressMonitor.worked(1); 86 83 } 87 84 }; 88 85 try (InputStream in = getInputStream(query, NullProgressMonitor.INSTANCE)) { 89 86 rdr.addData(in); 90 } catch (IOException | IllegalDataException | OsmTransferExceptione) {87 } catch (IOException | IllegalDataException e) { 91 88 Logging.warn(e); 89 throw new OsmTransferException(e); 92 90 } finally { 93 91 rdr.callback = null; -
applications/editors/josm/plugins/reverter/src/reverter/RevertChangesetTask.java
r35464 r35638 98 98 newLayer = false; // reuse layer for subsequent reverts 99 99 } catch (OsmTransferException e) { 100 if (!allcmds.isEmpty()) { 101 GuiHelper.runInEDT(() -> UndoRedoHandler.getInstance().undo(allcmds.size())); 102 } 100 rollback(allcmds); 103 101 Logging.error(e); 104 102 throw e; 105 103 } catch (UserCancelException e) { 106 if (!allcmds.isEmpty()) { 107 GuiHelper.runInEDT(() -> UndoRedoHandler.getInstance().undo(allcmds.size())); 108 } 109 Logging.warn("Revert canceled"); 104 rollback(allcmds); 105 GuiHelper.executeByMainWorkerInEDT(() -> new Notification(tr("Revert was canceled")).show()); 110 106 Logging.trace(e); 111 107 return; … … 120 116 } 121 117 }); 118 } 119 } 120 121 private static void rollback(List<Command> allcmds) { 122 if (!allcmds.isEmpty()) { 123 GuiHelper.runInEDT(() -> UndoRedoHandler.getInstance().undo(allcmds.size())); 122 124 } 123 125 } … … 185 187 } 186 188 187 188 189 @Override 190 protected void cancel() { 189 191 // nothing to do 190 191 192 193 192 } 193 194 @Override 195 protected void finish() { 194 196 // nothing to do 195 197 196 198 } 197 199 198 200 /** 201 * Return number of conflicts for this changeset. 199 202 * @return number of conflicts for this changeset 200 203 */
Note:
See TracChangeset
for help on using the changeset viewer.