public class PluginDownloadTask extends PleaseWaitRunnable
getDownloadedPlugins()
replies the list of downloaded plugins
and getFailedPlugins()
replies the list of failed plugins.Modifier and Type | Field and Description |
---|---|
private boolean |
canceled |
private HttpURLConnection |
downloadConnection |
private Collection<PluginInformation> |
downloaded |
private Collection<PluginInformation> |
failed |
private Exception |
lastException |
private Collection<PluginInformation> |
toUpdate |
progressMonitor
Constructor and Description |
---|
PluginDownloadTask(Component parent,
Collection<PluginInformation> toUpdate,
String title)
Creates the download task
|
PluginDownloadTask(ProgressMonitor monitor,
Collection<PluginInformation> toUpdate,
String title)
Creates the task
|
Modifier and Type | Method and Description |
---|---|
protected void |
cancel()
User pressed cancel button.
|
protected void |
download(PluginInformation pi,
File file) |
protected void |
finish()
Finish up the data work.
|
Collection<PluginInformation> |
getDownloadedPlugins()
Replies the list of plugins whose download has failed
|
Collection<PluginInformation> |
getFailedPlugins()
Replies the list of successfully downloaded plugins
|
boolean |
isCanceled()
Replies true if the task was canceled by the user
|
protected void |
realRun()
Called in the worker thread to do the actual work.
|
void |
setPluginsToDownload(Collection<PluginInformation> toUpdate)
Sets the collection of plugins to update.
|
afterFinish, canRunInBackground, getProgressMonitor, operationCanceled, run
private final Collection<PluginInformation> toUpdate
private final Collection<PluginInformation> failed
private final Collection<PluginInformation> downloaded
private Exception lastException
private boolean canceled
private HttpURLConnection downloadConnection
public PluginDownloadTask(Component parent, Collection<PluginInformation> toUpdate, String title) throws IllegalArgumentException
parent
- the parent component relative to which the PleaseWaitDialog
is displayedtoUpdate
- a collection of plugin descriptions for plugins to update/download. Must not be null.title
- the title to display in the PleaseWaitDialog
IllegalArgumentException
- thrown if toUpdate is nullpublic PluginDownloadTask(ProgressMonitor monitor, Collection<PluginInformation> toUpdate, String title)
monitor
- a progress monitor. Defaults to NullProgressMonitor.INSTANCE
if nulltoUpdate
- a collection of plugin descriptions for plugins to update/download. Must not be null.title
- the title to display in the PleaseWaitDialog
IllegalArgumentException
- thrown if toUpdate is nullpublic void setPluginsToDownload(Collection<PluginInformation> toUpdate) throws IllegalArgumentException
toUpdate
- the collection of plugins to update. Must not be null.IllegalArgumentException
- thrown if toUpdate is nullprotected void cancel()
PleaseWaitRunnable
cancel
in class PleaseWaitRunnable
protected void finish()
PleaseWaitRunnable
finish
in class PleaseWaitRunnable
protected void download(PluginInformation pi, File file) throws PluginDownloadException
PluginDownloadException
protected void realRun() throws SAXException, IOException
PleaseWaitRunnable
realRun
in class PleaseWaitRunnable
SAXException
IOException
public boolean isCanceled()
true
if the task was stopped by the userpublic Collection<PluginInformation> getFailedPlugins()
public Collection<PluginInformation> getDownloadedPlugins()