Loads a selection of sources into PCGen asynchronously and tracks the load progress on the status bar. While sources are being loaded any calls to this method are ignored until sources are finished loading. @param sources a SourceSelectionFacade specifying the sources to load @return true if the sou
(SourceSelectionFacade sources)
| 482 | * @return true if the sources are loaded or are loading |
| 483 | */ |
| 484 | public boolean loadSourceSelection(SourceSelectionFacade sources) |
| 485 | { |
| 486 | if (sources == null) |
| 487 | { |
| 488 | return false; |
| 489 | } |
| 490 | if (sourceLoader != null && sourceLoader.isAlive()) |
| 491 | { |
| 492 | return checkSourceEquality(sources, sourceLoader.sources); |
| 493 | } |
| 494 | if (checkSourceEquality(sources, currentSourceSelection.get())) |
| 495 | { |
| 496 | return true; |
| 497 | } |
| 498 | //make sure all characters are closed before loading new sources. |
| 499 | if (closeAllCharacters()) |
| 500 | { |
| 501 | sourceLoader = new SourceLoadWorker(sources, this); |
| 502 | sourceLoader.start(); |
| 503 | return true; |
| 504 | } |
| 505 | return false; |
| 506 | } |
| 507 | |
| 508 | private boolean checkSourceEquality(SourceSelectionFacade source1, SourceSelectionFacade source2) |
| 509 | { |
no test coverage detected