Changeset 6773 in josm
- Timestamp:
- 2014-01-29T21:30:14+01:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
r6762 r6773 8 8 import java.io.Reader; 9 9 import java.util.ArrayList; 10 import java.util.Arrays; 10 11 import java.util.Collection; 12 import java.util.Collections; 11 13 import java.util.HashMap; 12 14 import java.util.Iterator; … … 361 363 */ 362 364 TestError getErrorForPrimitive(OsmPrimitive p) { 363 return getErrorForPrimitive(p, whichSelectorMatchesPrimitive(p)); 364 } 365 366 TestError getErrorForPrimitive(OsmPrimitive p, Selector matchingSelector) { 365 final Environment env = new Environment().withPrimitive(p); 366 return getErrorForPrimitive(p, whichSelectorMatchesEnvironment(env), env); 367 } 368 369 TestError getErrorForPrimitive(OsmPrimitive p, Selector matchingSelector, Environment env) { 367 370 if (matchingSelector != null && !errors.isEmpty()) { 368 371 final Command fix = fixPrimitive(p); 369 372 final String description = getDescriptionForMatchingSelector(p, matchingSelector); 373 final List<OsmPrimitive> primitives; 374 if (env.child != null) { 375 primitives = Arrays.asList(p, env.child); 376 } else { 377 primitives = Collections.singletonList(p); 378 } 370 379 if (fix != null) { 371 return new FixableTestError(null, getSeverity(), description, null, matchingSelector.toString(), 3000, p , fix);380 return new FixableTestError(null, getSeverity(), description, null, matchingSelector.toString(), 3000, primitives, fix); 372 381 } else { 373 return new TestError(null, getSeverity(), description, null, matchingSelector.toString(), 3000, p );382 return new TestError(null, getSeverity(), description, null, matchingSelector.toString(), 3000, primitives); 374 383 } 375 384 } else { … … 407 416 if (selector != null) { 408 417 check.rule.execute(env); 409 final TestError error = check.getErrorForPrimitive(p, selector );418 final TestError error = check.getErrorForPrimitive(p, selector, env); 410 419 if (error != null) { 411 420 error.setTester(new MapCSSTagCheckerAndRule(check.rule));
Note:
See TracChangeset
for help on using the changeset viewer.