- Timestamp:
- 2023-06-14T22:27:42+02:00 (18 months ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/mapmode/SplitMode.java
r18760 r18761 109 109 } 110 110 111 112 113 111 @Override 114 112 public void mousePressed(MouseEvent e) { … … 229 227 } 230 228 231 232 233 229 @Override 234 230 public String getModeHelpText() { … … 442 438 } 443 439 444 445 446 440 /** 447 441 * Split a specified {@link Way} at the given nodes … … 464 458 * @param selection (Optional, can be null) Selection which should be updated 465 459 */ 466 publicSplitWayActionConcrete(Way splitWay, List<Node> splitNodes, List<OsmPrimitive> selection) {460 SplitWayActionConcrete(Way splitWay, List<Node> splitNodes, List<OsmPrimitive> selection) { 467 461 super(tr("Split way {0}", DefaultNameFormatter.getInstance().format(splitWay)), 468 462 ImageProvider.get(splitWay.getType())); -
trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagCheckerAsserts.java
r18757 r18761 67 67 final boolean isError = pErrors.stream().anyMatch(e -> e.getTester() instanceof MapCSSTagChecker.MapCSSTagCheckerAndRule 68 68 && ((MapCSSTagChecker.MapCSSTagCheckerAndRule) e.getTester()).rule.equals(check.rule)); 69 if (isError != i.getValue()) { 69 final boolean iValue = Boolean.TRUE.equals(i.getValue()); 70 if (isError != iValue) { 70 71 assertionConsumer.accept(MessageFormat.format("Expecting test ''{0}'' (i.e., {1}) to {2} {3} (i.e., {4})", 71 check.getMessage( p), check.rule.selectors, i.getValue()? "match" : "not match", i.getKey(), p.getKeys()));72 check.getMessage(null, p), check.rule.selectors, iValue ? "match" : "not match", i.getKey(), p.getKeys())); 72 73 } 73 74 if (isError) { … … 76 77 if (fix != null && fix.executeCommand() && !MapCSSTagChecker.getErrorsForPrimitive(p, true, checksToRun).isEmpty()) { 77 78 assertionConsumer.accept(MessageFormat.format("Autofix does not work for test ''{0}'' (i.e., {1}). Failing test: {2}", 78 check.getMessage( p), check.rule.selectors, i.getKey()));79 check.getMessage(null, p), check.rule.selectors, i.getKey())); 79 80 } 80 81 } … … 84 85 } 85 86 87 /** 88 * Clear previous checks (remove from memory) 89 */ 86 90 public static void clear() { 87 91 previousChecks.clear(); … … 106 110 return check.rule.selectors.stream() 107 111 .filter(s -> s instanceof Selector.GeneralSelector) 108 .flatMap(s -> ((Selector.GeneralSelector) s).getConditions().stream())112 .flatMap(s -> s.getConditions().stream()) 109 113 .filter(c -> c instanceof ConditionFactory.ExpressionCondition) 110 114 .map(c -> ((ConditionFactory.ExpressionCondition) c).getExpression()) … … 112 116 .map(c -> (ExpressionFactory.IsInsideFunction) c) 113 117 .map(ExpressionFactory.IsInsideFunction::getArg) 114 .filter( e -> e instanceof LiteralExpression)118 .filter(LiteralExpression.class::isInstance) 115 119 .map(e -> ((LiteralExpression) e).getLiteral()) 116 .filter( l -> l instanceof String)120 .filter(String.class::isInstance) 117 121 .map(l -> ((String) l).split(",", -1)[0]) 118 122 .findFirst(); -
trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagCheckerRule.java
r18757 r18761 267 267 * Constructs a (localized) message for this deprecation check. 268 268 * 269 * @param selector The selector to use 269 270 * @param p OSM primitive 270 271 * @return a message 271 272 */ 272 String getMessage( OsmPrimitive p) {273 String getMessage(Selector selector, OsmPrimitive p) { 273 274 if (errors.isEmpty()) { 274 275 // Return something to avoid NPEs … … 276 277 } else { 277 278 final Object val = errors.keySet().iterator().next().val; 279 selector = selector == null ? whichSelectorMatchesPrimitive(p) : selector; 278 280 return String.valueOf( 279 281 val instanceof Expression 280 ? ((Expression) val).evaluate(new Environment(p).withSelector( p == null ? null : whichSelectorMatchesPrimitive(p)))282 ? ((Expression) val).evaluate(new Environment(p).withSelector(selector)) 281 283 : val 282 284 ); … … 287 289 * Constructs a (localized) description for this deprecation check. 288 290 * 291 * @param selector The selector to use 289 292 * @param p OSM primitive 290 293 * @return a description (possibly with alternative suggestions) 291 294 * @see #getDescriptionForMatchingSelector 292 295 */ 293 String getDescription( OsmPrimitive p) {296 String getDescription(Selector selector, OsmPrimitive p) { 294 297 if (alternatives.isEmpty()) { 295 return getMessage( p);298 return getMessage(selector, p); 296 299 } else { 297 300 /* I18N: {0} is the test error message and {1} is an alternative */ 298 return tr("{0}, use {1} instead", getMessage( p), String.join(tr(" or "), alternatives));301 return tr("{0}, use {1} instead", getMessage(selector, p), String.join(tr(" or "), alternatives)); 299 302 } 300 303 } … … 309 312 */ 310 313 String getDescriptionForMatchingSelector(OsmPrimitive p, Selector matchingSelector) { 311 return insertArguments(matchingSelector, getDescription( p), p);314 return insertArguments(matchingSelector, getDescription(matchingSelector, p), p); 312 315 } 313 316 … … 318 321 @Override 319 322 public String toString() { 320 return getDescription(null );323 return getDescription(null, null); 321 324 } 322 325
Note:
See TracChangeset
for help on using the changeset viewer.