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>availablePluginsprivate booleancanceled-
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 voidanalyseInProcessPlugins()protected voidcancel()User pressed cancel button.protected voidfilterIrrelevantPlugins()protected voidfilterOldPlugins()protected voidfinish()Finish up the data work.java.util.List<PluginInformation>getAvailablePlugins()Replies information about available plugins detected by this task.booleanisCanceled()Replies true if the task was canceled by the userprivate static java.io.File[]listFiles(java.io.File pluginsDirectory, java.lang.String regex)protected voidprocessJarFile(java.io.File f, java.lang.String pluginName)protected voidprocessLocalPluginInformationFile(java.io.File file)protected voidrealRun()Called in the worker thread to do the actual work.protected voidscanLocalPluginRepository(ProgressMonitor progressMonitor, java.io.File pluginsDirectory)protected voidscanPluginFiles(ProgressMonitor monitor, java.io.File pluginsDirectory)protected voidscanSiteCacheFiles(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:PleaseWaitRunnableUser pressed cancel button.- Specified by:
cancelin classPleaseWaitRunnable
-
finish
protected void 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
-
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: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:
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
-
-