Package org.openstreetmap.josm.plugins
Class PluginDownloadTask
java.lang.Object
org.openstreetmap.josm.gui.PleaseWaitRunnable
org.openstreetmap.josm.plugins.PluginDownloadTask
- All Implemented Interfaces:
Runnable,ProgressMonitor.CancelListener
Asynchronous task for downloading a collection of plugins.
When the task is finished
getDownloadedPlugins() replies the list of downloaded plugins
and getFailedPlugins() replies the list of failed plugins.- Since:
- 2817
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate HttpClientprivate final Collection<PluginInformation>private final Collection<PluginInformation>private Exceptionstatic final StringThe accepted MIME types sent in the HTTP Accept header.private final Collection<PluginInformation>Fields inherited from class org.openstreetmap.josm.gui.PleaseWaitRunnable
progressMonitor -
Constructor Summary
ConstructorsConstructorDescriptionPluginDownloadTask(Component parent, Collection<PluginInformation> toUpdate, String title) Creates the download taskPluginDownloadTask(ProgressMonitor monitor, Collection<PluginInformation> toUpdate, String title) Creates the task -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcancel()User pressed cancel button.protected voiddownload(PluginInformation pi, File file) protected voidfinish()Finish up the data work.Replies the list of successfully downloaded plugins.Replies the list of plugins whose download has failed.Replies the last exception that occurred during download, ornull.booleanReplies true if the task was canceled by the userprotected voidrealRun()Called in the worker thread to do the actual work.voidsetPluginsToDownload(Collection<PluginInformation> toUpdate) Sets the collection of plugins to update.Methods inherited from class org.openstreetmap.josm.gui.PleaseWaitRunnable
afterFinish, canRunInBackground, getProgressMonitor, operationCanceled, run
-
Field Details
-
PLUGIN_MIME_TYPES
The accepted MIME types sent in the HTTP Accept header.- Since:
- 6867
- See Also:
-
toUpdate
-
failed
-
downloaded
-
lastException
-
canceled
-
downloadConnection
-
-
Constructor Details
-
PluginDownloadTask
Creates the download task- Parameters:
parent- the parent component relative to which thePleaseWaitDialogis displayedtoUpdate- a collection of plugin descriptions for plugins to update/download. Must not be null.title- the title to display in thePleaseWaitDialog- Throws:
IllegalArgumentException- if toUpdate is null
-
PluginDownloadTask
public PluginDownloadTask(ProgressMonitor monitor, Collection<PluginInformation> toUpdate, String title) Creates the task- Parameters:
monitor- a progress monitor. Defaults toNullProgressMonitor.INSTANCEif nulltoUpdate- a collection of plugin descriptions for plugins to update/download. Must not be null.title- the title to display in thePleaseWaitDialog- Throws:
IllegalArgumentException- if toUpdate is null
-
-
Method Details
-
setPluginsToDownload
Sets the collection of plugins to update.- Parameters:
toUpdate- the collection of plugins to update. Must not be null.- Throws:
IllegalArgumentException- if toUpdate is null
-
cancel
Description copied from class:PleaseWaitRunnableUser pressed cancel button.- Specified by:
cancelin classPleaseWaitRunnable
-
finish
Description copied from class:PleaseWaitRunnableFinish up the data work. Is guaranteed to be called if realRun is called. Finish is called in the gui thread just after the dialog disappeared.- Specified by:
finishin classPleaseWaitRunnable
-
download
- Throws:
PluginDownloadException
-
realRun
Description copied from class:PleaseWaitRunnableCalled in the worker thread to do the actual work. When any of the exception is thrown, a message box will be displayed and closeDialog is called. finish() is called in any case.- Specified by:
realRunin classPleaseWaitRunnable- Throws:
SAXException- if a SAX error occursIOException- if an I/O error occurs
-
isCanceled
Replies true if the task was canceled by the user- Returns:
trueif the task was stopped by the user
-
getFailedPlugins
Replies the list of plugins whose download has failed.- Returns:
- the list of plugins whose download has failed
-
getDownloadedPlugins
Replies the list of successfully downloaded plugins.- Returns:
- the list of successfully downloaded plugins
-
getLastException
Replies the last exception that occurred during download, ornull.- Returns:
- the last exception that occurred during download, or
null - Since:
- 9621
-