Changeset 14973 in josm
- Timestamp:
- 2019-04-08T10:24:31+02:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/validator/ValidatorTreePanel.java
r14908 r14973 41 41 import org.openstreetmap.josm.data.validation.TestError; 42 42 import org.openstreetmap.josm.gui.util.GuiHelper; 43 import org.openstreetmap.josm.tools.AlphanumComparator;44 43 import org.openstreetmap.josm.tools.Destroyable; 45 44 import org.openstreetmap.josm.tools.ListenerList; 46 import org.openstreetmap.josm.tools.Pair;47 45 48 46 /** … … 333 331 334 332 /** 335 * Sort list of errors in place (#8517).336 */337 void sortErrors() {338 if (errors.isEmpty())339 return;340 // Calculate the string to sort only once for each element341 // Avoids to call TestError.compare() which is costly342 List<Pair<String, TestError>> toSort = new ArrayList<>();343 for (int i = 0; i < errors.size(); i++) {344 TestError e = errors.get(i);345 toSort.add(new Pair<>(e.getNameVisitor().getText(), e));346 }347 toSort.sort((o1, o2) -> AlphanumComparator.getInstance().compare(o1.a, o2.a));348 List<TestError> sortedErrors = new ArrayList<>(errors.size());349 for (Pair<String, TestError> p : toSort) {350 sortedErrors.add(p.b);351 }352 errors.clear();353 errors.addAll(sortedErrors);354 }355 356 /**357 333 * Add a new invalidation listener 358 334 * @param listener The listener … … 379 355 return; 380 356 this.errors = errors != null ? errors : new ArrayList<>(); 381 sortErrors();382 357 if (isVisible()) { 383 358 //TODO: If list is changed because another layer was activated it would be good to store/restore … … 399 374 } 400 375 } 401 sortErrors();402 376 if (isVisible()) { 403 377 buildTree();
Note:
See TracChangeset
for help on using the changeset viewer.