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 HttpClient |
downloadConnection |
private Collection<PluginInformation> |
downloaded |
private Collection<PluginInformation> |
failed |
static String |
PLUGIN_MIME_TYPES
The accepted MIME types sent in the HTTP Accept header.
|
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 successfully downloaded plugins.
|
Collection<PluginInformation> |
getFailedPlugins()
Replies the list of plugins whose download has failed.
|
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
public static final String PLUGIN_MIME_TYPES
private final Collection<PluginInformation> toUpdate
private final Collection<PluginInformation> failed
private final Collection<PluginInformation> downloaded
private boolean canceled
private HttpClient downloadConnection
public PluginDownloadTask(Component parent, Collection<PluginInformation> toUpdate, String title)
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
- 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
- if toUpdate is nullpublic void setPluginsToDownload(Collection<PluginInformation> toUpdate)
toUpdate
- the collection of plugins to update. Must not be null.IllegalArgumentException
- 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
- if a SAX error occursIOException
- if an I/O error occurspublic boolean isCanceled()
true
if the task was stopped by the userpublic Collection<PluginInformation> getFailedPlugins()
public Collection<PluginInformation> getDownloadedPlugins()