Changeset 15972 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2020-03-01T10:34:23+01:00 (5 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/Test.java
r15755 r15972 382 382 showElementCount = b; 383 383 } 384 385 /** 386 * @return the name of this class (for ToolTip) 387 * since 15972 388 */ 389 public Object getSource() { 390 return "Java: " + this.getClass().getName(); 391 } 384 392 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
r15959 r15972 107 107 /** MapCSS declaration **/ 108 108 public final Declaration declaration; 109 /** MapCSS source **/ 110 public final String source; 111 112 /** 113 * Constructs a new {@code GroupedMapCSSRule} with empty source 114 * @param selectors MapCSS selectors 115 * @param declaration MapCSS declaration 116 */ 117 public GroupedMapCSSRule(List<Selector> selectors, Declaration declaration) { 118 this(selectors, declaration, ""); 119 } 109 120 110 121 /** … … 112 123 * @param selectors MapCSS selectors 113 124 * @param declaration MapCSS declaration 114 */ 115 public GroupedMapCSSRule(List<Selector> selectors, Declaration declaration) { 125 * @param source the source of the rule 126 */ 127 public GroupedMapCSSRule(List<Selector> selectors, Declaration declaration, String source) { 116 128 this.selectors = selectors; 117 129 this.declaration = declaration; 130 this.source = source; 118 131 } 119 132 … … 391 404 392 405 static ParseResult readMapCSS(Reader css) throws ParseException { 406 return readMapCSS(css, ""); 407 } 408 409 static ParseResult readMapCSS(Reader css, String url) throws ParseException { 393 410 CheckParameterUtil.ensureParameterNotNull(css, "css"); 394 411 … … 415 432 try { 416 433 parseChecks.add(TagCheck.ofMapCSSRule( 417 new GroupedMapCSSRule(map.getValue(), map.getKey()))); 434 new GroupedMapCSSRule(map.getValue(), map.getKey(), url))); 418 435 } catch (IllegalDataException e) { 419 436 Logging.error("Cannot add MapCss rule: "+e.getMessage()); … … 707 724 return "MapCSSTagCheckerAndRule [rule=" + rule + ']'; 708 725 } 726 727 @Override 728 public String getSource() { 729 return tr("URL / File: {0}", rule.source); 730 } 709 731 } 710 732 … … 849 871 if (zip != null) 850 872 I18n.addTexts(cache.getFile()); 851 result = TagCheck.readMapCSS(reader); 873 result = TagCheck.readMapCSS(reader, url); 852 874 checks.remove(url); 853 875 checks.putAll(url, result.parseChecks); -
trunk/src/org/openstreetmap/josm/gui/dialogs/validator/ValidatorTreePanel.java
r15962 r15972 117 117 if (nodeInfo instanceof TestError) { 118 118 TestError error = (TestError) nodeInfo; 119 res = "<html>" +error.getNameVisitor().getText() + "<br>" + error.getMessage();119 res = error.getNameVisitor().getText() + "<br>" + error.getMessage(); 120 120 String d = error.getDescription(); 121 121 if (d != null) 122 122 res += "<br>" + d; 123 res += "<br>" + tr("Test: {0}", error.getTester().getName()); 124 res += "</html>"; 123 res += "<br>" + tr("Test: {0}", getTesterDetails(error)); 125 124 } else { 126 res = node.toString(); 127 } 128 } 129 return res; 125 Set<String> tests = new HashSet<>(); 126 visitTestErrors(node, err -> tests.add(getTesterDetails(err)), null); 127 String source = (tests.size() == 1) ? tr("Test: {0}", tests.iterator().next()) : tr("Different tests"); 128 res = node.toString() + "<br>" + source; 129 } 130 } 131 return "<html>" + res + "</html>"; 132 } 133 134 private static String getTesterDetails(TestError e) { 135 return e.getTester().getName() + "<br>" + e.getTester().getSource(); 130 136 } 131 137
Note:
See TracChangeset
for help on using the changeset viewer.