Changeset 6779 in josm
- Timestamp:
- 2014-01-29T23:19:15+01:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r6730 r6779 501 501 List<Callable<Void>> tasks = new ArrayList<Callable<Void>>(); 502 502 503 tasks.add(new Callable<Void>() {503 tasks.add(new InitializationTask(tr("Initializing OSM API")) { 504 504 505 505 @Override 506 public Void call() throws Exception {506 public void initialize() throws Exception { 507 507 // We try to establish an API connection early, so that any API 508 508 // capabilities are already known to the editor instance. However 509 509 // if it goes wrong that's not critical at this stage. 510 if (initListener != null) {511 initListener.updateStatus(tr("Initializing OSM API"));512 }513 510 try { 514 511 OsmApi.getOsmApi().initialize(null, true); … … 516 513 Main.warn(getErrorMessage(Utils.getRootCause(e))); 517 514 } 518 return null;519 515 } 520 516 }); 521 517 522 tasks.add(new Callable<Void>() {518 tasks.add(new InitializationTask(tr("Initializing validator")) { 523 519 524 520 @Override 525 public Void call() throws Exception { 526 if (initListener != null) { 527 initListener.updateStatus(tr("Initializing presets")); 528 } 529 TaggingPresetPreference.initialize(); 530 // some validator tests require the presets to be initialized 531 // TODO remove this dependency for parallel initialization 532 if (initListener != null) { 533 initListener.updateStatus(tr("Initializing validator")); 534 } 521 public void initialize() throws Exception { 535 522 validator = new OsmValidator(); 536 523 MapView.addLayerChangeListener(validator); 537 return null;538 524 } 539 525 }); 540 526 541 tasks.add(new Callable<Void>() {527 tasks.add(new InitializationTask(tr("Initializing presets")) { 542 528 543 529 @Override 544 public Void call() throws Exception { 545 if (initListener != null) { 546 initListener.updateStatus(tr("Initializing map styles")); 547 } 530 public void initialize() throws Exception { 531 TaggingPresetPreference.initialize(); 532 } 533 }); 534 535 tasks.add(new InitializationTask(tr("Initializing map styles")) { 536 537 @Override 538 public void initialize() throws Exception { 548 539 MapPaintPreference.initialize(); 549 return null;550 540 } 551 541 }); 552 542 553 tasks.add(new Callable<Void>() {543 tasks.add(new InitializationTask(tr("Loading imagery preferences")) { 554 544 555 545 @Override 556 public Void call() throws Exception { 557 if (initListener != null) { 558 initListener.updateStatus(tr("Loading imagery preferences")); 559 } 546 public void initialize() throws Exception { 560 547 ImageryPreference.initialize(); 561 return null;562 548 } 563 549 }); … … 590 576 contentPanePrivate.updateUI(); 591 577 578 } 579 580 private abstract class InitializationTask implements Callable<Void> { 581 582 private final String name; 583 584 protected InitializationTask(String name) { 585 this.name = name; 586 } 587 588 public abstract void initialize() throws Exception; 589 590 @Override 591 public Void call() throws Exception { 592 if (initListener != null) { 593 initListener.updateStatus(name); 594 } 595 final long startTime = System.currentTimeMillis(); 596 initialize(); 597 final long elapsedTime = System.currentTimeMillis() - startTime; 598 Main.debug(tr("{0} completed in {1}", name, Utils.getDurationString(elapsedTime))); 599 return null; 600 } 592 601 } 593 602 -
trunk/src/org/openstreetmap/josm/actions/ValidateAction.java
r6529 r6779 68 68 return; 69 69 70 OsmValidator.initializeTests(); 70 71 OsmValidator.initializeErrorLayer(); 71 72 -
trunk/src/org/openstreetmap/josm/actions/upload/ValidateUploadHook.java
r6683 r6779 143 143 144 144 if (ed.getValue() != 1) { 145 OsmValidator.initializeTests(); 145 146 OsmValidator.initializeErrorLayer(); 146 147 Main.map.validatorDialog.unfurlDialog(); -
trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java
r6691 r6779 138 138 checkValidatorDir(); 139 139 initializeGridDetail(); 140 initializeTests(getTests());141 140 loadIgnoredErrors(); //FIXME: load only when needed 142 141 } … … 295 294 } 296 295 296 private static boolean testsInitialized = false; 297 298 /** 299 * Initializes all tests if this operations hasn't been performed already. 300 */ 301 public static synchronized void initializeTests() { 302 if (!testsInitialized) { 303 Main.debug("Initializing validator tests"); 304 final long startTime = System.currentTimeMillis(); 305 initializeTests(getTests()); 306 testsInitialized = true; 307 final long elapsedTime = System.currentTimeMillis() - startTime; 308 Main.debug("Initializing validator tests completed in " + Utils.getDurationString(elapsedTime)); 309 } 310 } 311 297 312 /** 298 313 * Initializes all tests
Note:
See TracChangeset
for help on using the changeset viewer.