Changeset 14768 in josm for trunk/src/org/openstreetmap/josm/gui/dialogs/validator/ValidatorTreePanel.java
- Timestamp:
- 2019-02-08T11:34:38+01:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/validator/ValidatorTreePanel.java
r14672 r14768 40 40 import org.openstreetmap.josm.data.validation.Severity; 41 41 import org.openstreetmap.josm.data.validation.TestError; 42 import org.openstreetmap.josm.data.validation.util.MultipleNameVisitor;43 42 import org.openstreetmap.josm.gui.util.GuiHelper; 43 import org.openstreetmap.josm.tools.AlphanumComparator; 44 44 import org.openstreetmap.josm.tools.Destroyable; 45 45 import org.openstreetmap.josm.tools.ListenerList; 46 import org.openstreetmap.josm.tools.Pair; 46 47 47 48 /** … … 115 116 if (nodeInfo instanceof TestError) { 116 117 TestError error = (TestError) nodeInfo; 117 MultipleNameVisitor v = new MultipleNameVisitor(); 118 v.visit(error.getPrimitives()); 119 res = "<html>" + v.getText() + "<br>" + error.getMessage(); 118 res = "<html>" + error.getNameVisitor().getText() + "<br>" + error.getMessage(); 120 119 String d = error.getDescription(); 121 120 if (d != null) … … 156 155 } 157 156 // Sort validation errors - #8517 158 Collections.sort(errors);157 sortErrors(errors); 159 158 160 159 // Remember the currently expanded rows … … 270 269 271 270 /** 271 * Sort list or errors in place. 272 * @param errors error list to be sorted 273 */ 274 static void sortErrors(List<TestError> errors) { 275 // Calculate the string to sort only once for each element 276 // Avoids to call TestError.compare() which costly 277 List<Pair<String, TestError>> toSort = new ArrayList<>(); 278 for (int i = 0; i < errors.size(); i++) { 279 TestError e = errors.get(i); 280 toSort.add(new Pair<>(e.getNameVisitor().getText(), e)); 281 } 282 toSort.sort((o1,o2) -> AlphanumComparator.getInstance().compare(o1.a, o2.a)); 283 List<TestError> sortedErrors = new ArrayList<>(errors.size()); 284 for (Pair<String, TestError> p : toSort) { 285 sortedErrors.add(p.b); 286 } 287 errors.clear(); 288 errors.addAll(sortedErrors); 289 } 290 291 /** 272 292 * Add a new invalidation listener 273 293 * @param listener The listener
Note:
See TracChangeset
for help on using the changeset viewer.