Package org.openstreetmap.josm.plugins
Class ReadLocalPluginInformationTask
- java.lang.Object
-
- org.openstreetmap.josm.gui.PleaseWaitRunnable
-
- org.openstreetmap.josm.plugins.ReadLocalPluginInformationTask
-
- All Implemented Interfaces:
java.lang.Runnable
,ProgressMonitor.CancelListener
public class ReadLocalPluginInformationTask extends PleaseWaitRunnable
This is an asynchronous task for reading plugin information from the files in the local plugin repositories. It scans the files in the local plugins repository (seePreferences.getPluginsDirectory()
and extracts plugin information from three kind of files:- .jar files, assuming that they represent plugin jars
- .jar.new files, assuming that these are downloaded but not yet installed plugins
- cached lists of available plugins, downloaded for instance from https://josm.openstreetmap.de/pluginicons
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,PluginInformation>
availablePlugins
private boolean
canceled
-
Fields inherited from class org.openstreetmap.josm.gui.PleaseWaitRunnable
progressMonitor
-
-
Constructor Summary
Constructors Constructor Description ReadLocalPluginInformationTask()
Constructs a newReadLocalPluginInformationTask
.ReadLocalPluginInformationTask(ProgressMonitor monitor)
Constructs a newReadLocalPluginInformationTask
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
analyseInProcessPlugins()
protected void
cancel()
User pressed cancel button.protected void
filterIrrelevantPlugins()
protected void
filterOldPlugins()
protected void
finish()
Finish up the data work.java.util.List<PluginInformation>
getAvailablePlugins()
Replies information about available plugins detected by this task.boolean
isCanceled()
Replies true if the task was canceled by the userprivate static java.io.File[]
listFiles(java.io.File pluginsDirectory, java.lang.String regex)
protected void
processJarFile(java.io.File f, java.lang.String pluginName)
protected void
processLocalPluginInformationFile(java.io.File file)
protected void
realRun()
Called in the worker thread to do the actual work.protected void
scanLocalPluginRepository(ProgressMonitor progressMonitor, java.io.File pluginsDirectory)
protected void
scanPluginFiles(ProgressMonitor monitor, java.io.File pluginsDirectory)
protected void
scanSiteCacheFiles(ProgressMonitor monitor, java.io.File pluginsDirectory)
-
Methods inherited from class org.openstreetmap.josm.gui.PleaseWaitRunnable
afterFinish, canRunInBackground, getProgressMonitor, operationCanceled, run
-
-
-
-
Field Detail
-
availablePlugins
private final java.util.Map<java.lang.String,PluginInformation> availablePlugins
-
canceled
private boolean canceled
-
-
Constructor Detail
-
ReadLocalPluginInformationTask
public ReadLocalPluginInformationTask()
Constructs a newReadLocalPluginInformationTask
.
-
ReadLocalPluginInformationTask
public ReadLocalPluginInformationTask(ProgressMonitor monitor)
Constructs a newReadLocalPluginInformationTask
.- Parameters:
monitor
- progress monitor
-
-
Method Detail
-
cancel
protected void cancel()
Description copied from class:PleaseWaitRunnable
User pressed cancel button.- Specified by:
cancel
in classPleaseWaitRunnable
-
finish
protected void finish()
Description copied from class:PleaseWaitRunnable
Finish 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:
finish
in classPleaseWaitRunnable
-
processJarFile
protected void processJarFile(java.io.File f, java.lang.String pluginName) throws PluginException
- Throws:
PluginException
-
listFiles
private static java.io.File[] listFiles(java.io.File pluginsDirectory, java.lang.String regex)
-
scanSiteCacheFiles
protected void scanSiteCacheFiles(ProgressMonitor monitor, java.io.File pluginsDirectory)
-
scanPluginFiles
protected void scanPluginFiles(ProgressMonitor monitor, java.io.File pluginsDirectory)
-
scanLocalPluginRepository
protected void scanLocalPluginRepository(ProgressMonitor progressMonitor, java.io.File pluginsDirectory)
-
processLocalPluginInformationFile
protected void processLocalPluginInformationFile(java.io.File file) throws PluginListParseException
- Throws:
PluginListParseException
-
analyseInProcessPlugins
protected void analyseInProcessPlugins()
-
filterOldPlugins
protected void filterOldPlugins()
-
filterIrrelevantPlugins
protected void filterIrrelevantPlugins()
-
realRun
protected void realRun() throws org.xml.sax.SAXException, java.io.IOException, OsmTransferException
Description copied from class:PleaseWaitRunnable
Called 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:
realRun
in classPleaseWaitRunnable
- Throws:
org.xml.sax.SAXException
- if a SAX error occursjava.io.IOException
- if an I/O error occursOsmTransferException
- if a communication error with the OSM server occurs
-
getAvailablePlugins
public java.util.List<PluginInformation> getAvailablePlugins()
Replies information about available plugins detected by this task.- Returns:
- information about available plugins detected by this task.
-
isCanceled
public boolean isCanceled()
Replies true if the task was canceled by the user- Returns:
- true if the task was canceled by the user
-
-