This is tricky. Unlike other implementations that connect in the setup method, this implementation connects when the first path selection is done. The code in BasicBreadcrumbBar.PopupAction.actionPerformed(ActionEvent) adds two items - the selected SVN repository and the matching choices. The first addition requires connecting to the selected repository, which is done off EDT (using {@link SwingWorker}). The second addition must wait until the connection has been established since otherwise the repository is not yet available. In order to make the second addition wait, we use a {@link CountDownLatch}.
It is {@link CountDownLatch#countDown()} in theSwingWorker.done()
that wraps the connection. The {@link BreadcrumbBarCallBack#getPathChoices(BreadcrumbItem[])} and{@link BreadcrumbBarCallBack#getLeafs(BreadcrumbItem[])} call{@link CountDownLatch#await()} on the same latch that blocks until theconnection is done. Since both these methods should be wrapped off EDT in a separate {@link SwingWorker}, this doesn't block the UI.
|
|