in plugin/src/main/kotlin/org/jetbrains/downloadThis/DownloadLauncher.kt [45:68]
override fun run(indicator: ProgressIndicator) {
LOG.debug("Downloading '$link' to '$destinationDir'")
download(link, File(destinationDir)) {
when (it) {
is Downloading -> SwingUtilities.invokeLater {
indicator.fraction = it.fraction
}
is Failed -> SwingUtilities.invokeLater {
Messages.showErrorDialog(
project,
DOWNLOAD_ANY_LINK_CANT_DOWNLOAD_LINK_MESSAGE.format(it.reason, link),
DOWNLOAD_ANY_LINK_CANT_DOWNLOAD_LINK_TITLE
)
}
is Finished -> DownloadFinishNotifier.notify(
project = project,
title = "Download finished",
content = """<a href="${it.destinationFile}">${it.destinationFile}</a>""" // todo: make it openable by IDE
)
}
}
}