Changeset 6636 in josm
- Timestamp:
- 2014-01-05T19:32:00+01:00 (11 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/upload/ValidateUploadHook.java
r6529 r6636 60 60 test.visit(selection); 61 61 test.endTest(); 62 if ( Main.pref.getBoolean(ValidatorPreference.PREF_OTHER, false) &&62 if (ValidatorPreference.PREF_OTHER.get() && 63 63 Main.pref.getBoolean(ValidatorPreference.PREF_OTHER_UPLOAD, false)) { 64 64 errors.addAll(test.getErrors()); -
trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
r6612 r6636 40 40 import org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.MapCSSParser; 41 41 import org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.ParseException; 42 import org.openstreetmap.josm.gui.preferences.validator.ValidatorPreference; 42 43 import org.openstreetmap.josm.gui.widgets.EditableList; 43 44 import org.openstreetmap.josm.io.MirroredInputStream; … … 284 285 */ 285 286 String getMessage() { 286 return errors. keySet().iterator().next();287 return errors.isEmpty() ? null : errors.keySet().iterator().next(); 287 288 } 288 289 … … 313 314 314 315 Severity getSeverity() { 315 return errors. values().iterator().next();316 return errors.isEmpty() ? null : errors.values().iterator().next(); 316 317 } 317 318 … … 364 365 * Obtains all {@link TestError}s for the {@link OsmPrimitive} {@code p}. 365 366 */ 366 public Collection<TestError> getErrorsForPrimitive(OsmPrimitive p ) {367 public Collection<TestError> getErrorsForPrimitive(OsmPrimitive p, boolean includeOtherSeverity) { 367 368 final ArrayList<TestError> r = new ArrayList<TestError>(); 368 369 final Environment env = new Environment(p, new MultiCascade(), Environment.DEFAULT_LAYER, null); 369 370 for (TagCheck check : checks) { 371 if (Severity.OTHER.equals(check.getSeverity()) && !includeOtherSeverity) { 372 continue; 373 } 370 374 final Selector selector = check.whichSelectorMatchesEnvironment(env); 371 375 if (selector != null) { … … 388 392 @Override 389 393 public void check(OsmPrimitive p) { 390 errors.addAll(getErrorsForPrimitive(p ));394 errors.addAll(getErrorsForPrimitive(p, ValidatorPreference.PREF_OTHER.get())); 391 395 } 392 396 -
trunk/src/org/openstreetmap/josm/gui/dialogs/validator/ValidatorTreePanel.java
r6529 r6636 161 161 } 162 162 163 boolean other = Main.pref.getBoolean(ValidatorPreference.PREF_OTHER, false);163 final Boolean other = ValidatorPreference.PREF_OTHER.get(); 164 164 for (TestError e : errors) { 165 165 if (e.getIgnored()) { -
trunk/src/org/openstreetmap/josm/gui/preferences/validator/ValidatorPreference.java
r6593 r6636 16 16 17 17 import org.openstreetmap.josm.Main; 18 import org.openstreetmap.josm.data.preferences.BooleanProperty; 18 19 import org.openstreetmap.josm.data.validation.OsmValidator; 19 20 import org.openstreetmap.josm.data.validation.Test; … … 64 65 public static final String PREF_OTHER_UPLOAD = PREFIX + ".otherUpload"; 65 66 66 /** The preferences keyfor ignored severity other */67 public static final String PREF_OTHER = PREFIX + ".other";67 /** The preferences for ignored severity other */ 68 public static final BooleanProperty PREF_OTHER = new BooleanProperty(PREFIX + ".other", false); 68 69 69 70 /** … … 95 96 testPanel.add(prefUseLayer, GBC.eol()); 96 97 97 prefOther = new JCheckBox(tr("Show informational level."), Main.pref.getBoolean(PREF_OTHER, false));98 prefOther = new JCheckBox(tr("Show informational level."), PREF_OTHER.get()); 98 99 prefOther.setToolTipText(tr("Show the informational tests.")); 99 100 testPanel.add(prefOther, GBC.eol()); … … 143 144 Main.pref.putCollection(PREF_SKIP_TESTS_BEFORE_UPLOAD, testsBeforeUpload); 144 145 Main.pref.put(PREF_USE_IGNORE, prefUseIgnore.isSelected()); 145 Main.pref.put(PREF_OTHER,prefOther.isSelected());146 PREF_OTHER.put(prefOther.isSelected()); 146 147 Main.pref.put(PREF_OTHER_UPLOAD, prefOtherUpload.isSelected()); 147 148 Main.pref.put(PREF_LAYER, prefUseLayer.isSelected()); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MapCSSTagCheckerTest.java
r6603 r6636 74 74 for (final Map.Entry<String, Boolean> i : check.assertions.entrySet()) { 75 75 final OsmPrimitive p = TestUtils.createPrimitive(i.getKey()); 76 final boolean isError = Utils.exists(c.getErrorsForPrimitive(p ), new Predicate<TestError>() {76 final boolean isError = Utils.exists(c.getErrorsForPrimitive(p, true), new Predicate<TestError>() { 77 77 @Override 78 78 public boolean evaluate(TestError e) {
Note:
See TracChangeset
for help on using the changeset viewer.