Package org.openstreetmap.josm.plugins
Class PluginHandler
- java.lang.Object
-
- org.openstreetmap.josm.plugins.PluginHandler
-
public final class PluginHandler extends java.lang.Object
PluginHandler is basically a collection of static utility functions used to bootstrap and manage the loaded plugins.- Since:
- 1326
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPluginHandler.DeprecatedPluginDescription of a deprecated plugin(package private) static classPluginHandler.PluginInformationActionprivate static classPluginHandler.UpdatePluginsMessagePanel
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringCANCELprivate static java.util.Map<java.lang.String,PluginClassLoader>classLoadersPlugin class loaders.static intDEFAULT_TIME_BASED_UPDATE_INTERVALDefault time-based update interval, in days (pluginmanager.time-based-update.interval)(package private) static java.util.List<PluginHandler.DeprecatedPlugin>DEPRECATED_PLUGINSDeprecated plugins that are removed on startprivate static java.lang.StringDIALOGSprivate static java.lang.StringDISABLE_PLUGINprivate static java.lang.StringHTML_ENDprivate static java.lang.StringHTML_STARTprivate static DynamicURLClassLoaderjoinedPluginResourceCLClass loader to locate resources from plugins.private static PluginDownloadTaskpluginDownloadTask(package private) static java.util.Collection<PluginProxy>pluginListAll installed and loaded plugins (resp.(package private) static java.util.Collection<PluginInformation>pluginListNotLoadedAll installed but not loaded plugins(package private) static java.util.Map<java.lang.String,java.lang.Throwable>pluginLoadingExceptionsAll exceptions that occurred during plugin loadingprivate static java.lang.StringPLUGINMANAGER_LASTUPDATEprivate static java.lang.StringPLUGINMANAGER_TIME_BASED_UPDATE_POLICYprivate static java.lang.StringPLUGINMANAGER_VERSION_BASED_UPDATE_POLICYprivate static java.lang.StringPLUGINSprivate static java.util.List<java.lang.ClassLoader>sourcesAdd here all ClassLoader whose resource should be searched.(package private) static java.util.List<java.lang.String>UNMAINTAINED_PLUGINSList of unmaintained plugins.private static java.lang.StringUPDATE_PLUGINSprivate static java.lang.StringWARNING
-
Constructor Summary
Constructors Modifier Constructor Description privatePluginHandler()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddDownloadSelection(java.util.List<DownloadSelection> downloadSelections)Called in the download dialog to give the plugins a chance to modify the list of bounding box selectors.private static voidalertFailedPluginUpdate(java.awt.Component parent, java.util.Collection<PluginInformation> plugins)private static voidalertJavaUpdateRequired(java.awt.Component parent, java.lang.String plugin, int requiredVersion)private static voidalertJOSMUpdateRequired(java.awt.Component parent, java.lang.String plugin, int requiredVersion)private static voidalertMissingPluginInformation(java.awt.Component parent, java.util.Collection<java.lang.String> plugins)private static voidalertMissingRequiredPlugin(java.awt.Component parent, java.lang.String plugin, java.util.Set<java.lang.String> missingRequiredPlugin)Alerts the user if a plugin required by another plugin is missing, and offer to download them & restart JOSMprivate static intaskUpdateDisableKeepPluginAfterException(PluginProxy plugin)static java.util.List<PluginInformation>buildListOfPluginsToLoad(java.awt.Component parent, ProgressMonitor monitor)Builds the list of plugins to load.static booleancheckAndConfirmPluginUpdate(java.awt.Component parent)Checks whether the locally available plugins should be updated and asks the user if running an update is OK.static booleancheckLoadPreconditions(java.awt.Component parent, java.util.Collection<PluginInformation> plugins, PluginInformation plugin)Checks whether all preconditions for loading the pluginpluginare met.static booleancheckRequiredPluginsPreconditions(java.awt.Component parent, java.util.Collection<PluginInformation> plugins, PluginInformation plugin, boolean local)Checks if required plugins preconditions for loading the pluginpluginare met.static booleanconfirmDisablePlugin(java.awt.Component parent, java.lang.String reason, java.lang.String name)Ask the user for confirmation that a plugin shall be disabled.private static voiddownloadRequiredPluginsAndRestart(java.awt.Component parent, java.util.Set<java.lang.String> missingRequiredPlugin)private static voidextendJoinedPluginResourceCL(java.util.Collection<PluginInformation> plugins)Add more plugins to the joined plugin resource class loader.(package private) static voidfilterDeprecatedPlugins(java.awt.Component parent, java.util.Collection<java.lang.String> plugins)Removes deprecated plugins from a collection of plugins.(package private) static voidfilterUnmaintainedPlugins(java.awt.Component parent, java.util.Collection<java.lang.String> plugins)Removes unmaintained plugins from a collection of plugins.private static java.util.Set<java.lang.String>findMissingPlugins(java.util.Collection<PluginInformation> plugins, PluginInformation plugin, boolean local)Find the missing plugin(s) for a specified pluginprivate static java.util.Set<PluginInformation>findRequiredPluginsToDownload(java.util.Collection<PluginInformation> pluginsToUpdate, java.util.List<PluginInformation> allPlugins, java.util.Set<PluginInformation> pluginsToDownload)static java.io.FilefindUpdatedJar(java.lang.String name)Replies the updated jar file for the given plugin name.private static voidgenerateClassloaders(java.util.List<PluginInformation> toLoad)Generate classloaders for a list of pluginsstatic java.util.Collection<java.lang.String>getBugReportInformation()Returns the list of loaded plugins as aStringto be displayed in status report.static java.util.Set<java.lang.String>getDeprecatedAndUnmaintainedPlugins()Returns the set of deprecated and unmaintained plugins.static javax.swing.JPanelgetInfoPanel()Returns the list of loaded plugins as aJPanelto be displayed in About dialog.private static DynamicURLClassLoadergetJoinedPluginResourceCL()Get class loader to locate resources from plugins.static java.lang.ObjectgetPlugin(java.lang.String name)Returns the plugin of the specified name.private static PluginProxygetPluginCausingException(java.lang.Throwable ex)Replies the plugin which most likely threw the exceptionex.static PluginClassLoadergetPluginClassLoader(java.lang.String name)Returns the plugin class loader for the plugin of the specified name.static java.util.Collection<PluginClassLoader>getPluginClassLoaders()Returns all plugin classloaders.static java.util.List<PluginInformation>getPlugins()Returns the list of currently installed and loaded plugins, sorted by name.static java.util.Collection<PreferenceSettingFactory>getPreferenceSetting()Returns the list of plugin preference settings.(package private) static java.lang.StringgetRemovedPluginsMessage(java.util.Collection<PluginHandler.DeprecatedPlugin> removedPlugins)static java.util.Collection<java.lang.ClassLoader>getResourceClassLoaders()Returns all ClassLoaders whose resource should be searched.(package private) static java.lang.StringgetUnmaintainedPluginMessage(java.lang.String unmaintained)static voidinstallDownloadedPlugins(java.util.Collection<PluginInformation> pluginsToLoad, boolean dowarn)Installs downloaded plugins.private static booleanisDependency(PluginInformation pi, java.lang.String depName)static booleanisValidJar(java.io.File jar)Determines if the specified file is a valid and accessible JAR file.static <S> java.util.ServiceLoader<S>load(java.lang.Class<S> service)Get aServiceLoaderfor the specified service.static voidloadEarlyPlugins(java.awt.Component parent, java.util.Collection<PluginInformation> plugins, ProgressMonitor monitor)Loads plugins frompluginswhich have the flagPluginInformation.earlyset to true and a non-negativePluginInformation.stagevalue.static voidloadLatePlugins(java.awt.Component parent, java.util.Collection<PluginInformation> plugins, ProgressMonitor monitor)Loads plugins frompluginswhich have the flagPluginInformation.earlyset to false.private static java.util.Map<java.lang.String,PluginInformation>loadLocallyAvailablePluginInformation(ProgressMonitor monitor)Loads locally available plugin information from local plugin jars and from cached plugin lists.private static voidloadPlugin(java.awt.Component parent, PluginInformation plugin, PluginClassLoader pluginClassLoader)Loads and instantiates the plugin described bypluginusing the class loaderpluginClassLoader.static voidloadPlugins(java.awt.Component parent, java.util.Collection<PluginInformation> plugins, ProgressMonitor monitor)Loads the plugin inpluginsfrom locally available jar files into memory.static voidloadVeryEarlyPlugins()Loads plugins frompluginswhich have the flagPluginInformation.earlyset to true and a negativePluginInformation.stagevalue.private static voidlogWrongPlatform(java.lang.String plugin, java.lang.String pluginPlatform)static voidrefreshLocalUpdatedPluginInfo(java.util.Collection<PluginInformation> updatedPlugins)Refreshes the given PluginInformation objects with new contents read from their corresponding jar file.static booleanremovePlugins(java.util.List<PluginInformation> deactivatedPlugins)Remove deactivated plugins, returning true if JOSM should restartprivate static voidresolveDependencies(java.util.List<PluginInformation> toLoad)Resolve dependencies for a list of pluginsstatic PluginDownloadTaskupdateOrdisablePluginAfterException(java.lang.Throwable e)Checks whether the exceptionewas thrown by a plugin.static java.util.Collection<PluginInformation>updatePlugins(java.awt.Component parent, java.util.Collection<PluginInformation> pluginsWanted, ProgressMonitor monitor, boolean displayErrMsg)Updates the plugins inplugins.
-
-
-
Field Detail
-
DIALOGS
private static final java.lang.String DIALOGS
- See Also:
- Constant Field Values
-
WARNING
private static final java.lang.String WARNING
-
HTML_START
private static final java.lang.String HTML_START
- See Also:
- Constant Field Values
-
HTML_END
private static final java.lang.String HTML_END
- See Also:
- Constant Field Values
-
UPDATE_PLUGINS
private static final java.lang.String UPDATE_PLUGINS
-
CANCEL
private static final java.lang.String CANCEL
- See Also:
- Constant Field Values
-
PLUGINS
private static final java.lang.String PLUGINS
- See Also:
- Constant Field Values
-
DISABLE_PLUGIN
private static final java.lang.String DISABLE_PLUGIN
-
PLUGINMANAGER_VERSION_BASED_UPDATE_POLICY
private static final java.lang.String PLUGINMANAGER_VERSION_BASED_UPDATE_POLICY
- See Also:
- Constant Field Values
-
PLUGINMANAGER_LASTUPDATE
private static final java.lang.String PLUGINMANAGER_LASTUPDATE
- See Also:
- Constant Field Values
-
PLUGINMANAGER_TIME_BASED_UPDATE_POLICY
private static final java.lang.String PLUGINMANAGER_TIME_BASED_UPDATE_POLICY
- See Also:
- Constant Field Values
-
DEPRECATED_PLUGINS
static final java.util.List<PluginHandler.DeprecatedPlugin> DEPRECATED_PLUGINS
Deprecated plugins that are removed on start
-
UNMAINTAINED_PLUGINS
static final java.util.List<java.lang.String> UNMAINTAINED_PLUGINS
List of unmaintained plugins. Not really up-to-date as the vast majority of plugins are not maintained after a few months, sadly...
-
DEFAULT_TIME_BASED_UPDATE_INTERVAL
public static final int DEFAULT_TIME_BASED_UPDATE_INTERVAL
Default time-based update interval, in days (pluginmanager.time-based-update.interval)- See Also:
- Constant Field Values
-
pluginList
static final java.util.Collection<PluginProxy> pluginList
All installed and loaded plugins (resp. their main classes)
-
pluginListNotLoaded
static final java.util.Collection<PluginInformation> pluginListNotLoaded
All installed but not loaded plugins
-
pluginLoadingExceptions
static final java.util.Map<java.lang.String,java.lang.Throwable> pluginLoadingExceptions
All exceptions that occurred during plugin loading
-
joinedPluginResourceCL
private static DynamicURLClassLoader joinedPluginResourceCL
Class loader to locate resources from plugins.- See Also:
getJoinedPluginResourceCL()
-
sources
private static final java.util.List<java.lang.ClassLoader> sources
Add here all ClassLoader whose resource should be searched.
-
classLoaders
private static final java.util.Map<java.lang.String,PluginClassLoader> classLoaders
Plugin class loaders.
-
pluginDownloadTask
private static PluginDownloadTask pluginDownloadTask
-
-
Constructor Detail
-
PluginHandler
private PluginHandler()
-
-
Method Detail
-
getPlugins
public static java.util.List<PluginInformation> getPlugins()
Returns the list of currently installed and loaded plugins, sorted by name.- Returns:
- the list of currently installed and loaded plugins, sorted by name
- Since:
- 10982
-
getResourceClassLoaders
public static java.util.Collection<java.lang.ClassLoader> getResourceClassLoaders()
Returns all ClassLoaders whose resource should be searched.- Returns:
- all ClassLoaders whose resource should be searched
-
getPluginClassLoaders
public static java.util.Collection<PluginClassLoader> getPluginClassLoaders()
Returns all plugin classloaders.- Returns:
- all plugin classloaders
- Since:
- 14978
-
load
public static <S> java.util.ServiceLoader<S> load(java.lang.Class<S> service)
Get aServiceLoaderfor the specified service. This usesgetJoinedPluginResourceCL()as the class loader, so that we don't have to iterate through theClassLoaders fromgetPluginClassLoaders().- Type Parameters:
S- The service type- Parameters:
service- The service class to look for- Returns:
- The service loader
- Since:
- 18833
-
filterDeprecatedPlugins
static void filterDeprecatedPlugins(java.awt.Component parent, java.util.Collection<java.lang.String> plugins)
Removes deprecated plugins from a collection of plugins. Modifies the collectionplugins.Also notifies the user about removed deprecated plugins
- Parameters:
parent- The parent Component used to display warning popupplugins- the collection of plugins
-
getRemovedPluginsMessage
static java.lang.String getRemovedPluginsMessage(java.util.Collection<PluginHandler.DeprecatedPlugin> removedPlugins)
-
filterUnmaintainedPlugins
static void filterUnmaintainedPlugins(java.awt.Component parent, java.util.Collection<java.lang.String> plugins)
Removes unmaintained plugins from a collection of plugins. Modifies the collectionplugins. Also removes the plugin from the list of plugins in the preferences, if necessary.Asks the user for every unmaintained plugin whether it should be removed.
- Parameters:
parent- The parent Component used to display warning popupplugins- the collection of plugins
-
getUnmaintainedPluginMessage
static java.lang.String getUnmaintainedPluginMessage(java.lang.String unmaintained)
-
checkAndConfirmPluginUpdate
public static boolean checkAndConfirmPluginUpdate(java.awt.Component parent)
Checks whether the locally available plugins should be updated and asks the user if running an update is OK. An update is advised if JOSM was updated to a new version since the last plugin updates or if the plugins were last updated a long time ago.- Parameters:
parent- the parent component relative to which the confirmation dialog is to be displayed- Returns:
- true if a plugin update should be run; false, otherwise
-
alertMissingRequiredPlugin
private static void alertMissingRequiredPlugin(java.awt.Component parent, java.lang.String plugin, java.util.Set<java.lang.String> missingRequiredPlugin)
Alerts the user if a plugin required by another plugin is missing, and offer to download them & restart JOSM- Parameters:
parent- The parent Component used to display error popupplugin- the pluginmissingRequiredPlugin- the missing required plugin
-
downloadRequiredPluginsAndRestart
private static void downloadRequiredPluginsAndRestart(java.awt.Component parent, java.util.Set<java.lang.String> missingRequiredPlugin)
-
logWrongPlatform
private static void logWrongPlatform(java.lang.String plugin, java.lang.String pluginPlatform)
-
alertJavaUpdateRequired
private static void alertJavaUpdateRequired(java.awt.Component parent, java.lang.String plugin, int requiredVersion)
-
alertJOSMUpdateRequired
private static void alertJOSMUpdateRequired(java.awt.Component parent, java.lang.String plugin, int requiredVersion)
-
checkLoadPreconditions
public static boolean checkLoadPreconditions(java.awt.Component parent, java.util.Collection<PluginInformation> plugins, PluginInformation plugin)
Checks whether all preconditions for loading the pluginpluginare met. The current Java and JOSM versions must be compatible with the plugin and no other plugins this plugin depends on should be missing.- Parameters:
parent- The parent Component used to display error popupplugins- the collection of all loaded pluginsplugin- the plugin for which preconditions are checked- Returns:
- true, if the preconditions are met; false otherwise
-
checkRequiredPluginsPreconditions
public static boolean checkRequiredPluginsPreconditions(java.awt.Component parent, java.util.Collection<PluginInformation> plugins, PluginInformation plugin, boolean local)
Checks if required plugins preconditions for loading the pluginpluginare met. No other plugins this plugin depends on should be missing.- Parameters:
parent- The parent Component used to display error popup. If parent is null, the error popup is suppressedplugins- the collection of all processed pluginsplugin- the plugin for which preconditions are checkedlocal- Determines if the local or up-to-date plugin dependencies are to be checked.- Returns:
- true, if the preconditions are met; false otherwise
- Since:
- 5601
-
findMissingPlugins
private static java.util.Set<java.lang.String> findMissingPlugins(java.util.Collection<PluginInformation> plugins, PluginInformation plugin, boolean local)
Find the missing plugin(s) for a specified plugin- Parameters:
plugins- The currently loaded pluginsplugin- The plugin to find the missing information forlocal- Determines if the local or up-to-date plugin dependencies are to be checked.- Returns:
- A set of missing plugins for the given plugin
-
getJoinedPluginResourceCL
private static DynamicURLClassLoader getJoinedPluginResourceCL()
Get class loader to locate resources from plugins.It joins URLs of all plugins, to find images, etc. (Not for loading Java classes - each plugin has a separate
PluginClassLoaderfor that purpose.)- Returns:
- class loader to locate resources from plugins
-
extendJoinedPluginResourceCL
private static void extendJoinedPluginResourceCL(java.util.Collection<PluginInformation> plugins)
Add more plugins to the joined plugin resource class loader.- Parameters:
plugins- the plugins to add
-
loadPlugin
private static void loadPlugin(java.awt.Component parent, PluginInformation plugin, PluginClassLoader pluginClassLoader)
Loads and instantiates the plugin described bypluginusing the class loaderpluginClassLoader.- Parameters:
parent- The parent component to be used for the displayed dialogplugin- the pluginpluginClassLoader- the plugin class loader
-
loadPlugins
public static void loadPlugins(java.awt.Component parent, java.util.Collection<PluginInformation> plugins, ProgressMonitor monitor)
Loads the plugin inpluginsfrom locally available jar files into memory.- Parameters:
parent- The parent component to be used for the displayed dialogplugins- the list of pluginsmonitor- the progress monitor. Defaults toNullProgressMonitor.INSTANCEif null.
-
generateClassloaders
private static void generateClassloaders(java.util.List<PluginInformation> toLoad)
Generate classloaders for a list of plugins- Parameters:
toLoad- The plugins to generate the classloaders for
-
resolveDependencies
private static void resolveDependencies(java.util.List<PluginInformation> toLoad)
Resolve dependencies for a list of plugins- Parameters:
toLoad- The plugins to resolve dependencies for
-
isDependency
private static boolean isDependency(PluginInformation pi, java.lang.String depName)
-
loadVeryEarlyPlugins
public static void loadVeryEarlyPlugins()
Loads plugins frompluginswhich have the flagPluginInformation.earlyset to true and a negativePluginInformation.stagevalue.This is meant for plugins that provide additional
LookAndFeel.
-
loadEarlyPlugins
public static void loadEarlyPlugins(java.awt.Component parent, java.util.Collection<PluginInformation> plugins, ProgressMonitor monitor)
Loads plugins frompluginswhich have the flagPluginInformation.earlyset to true and a non-negativePluginInformation.stagevalue.- Parameters:
parent- The parent component to be used for the displayed dialogplugins- the collection of pluginsmonitor- the progress monitor. Defaults toNullProgressMonitor.INSTANCEif null.
-
loadLatePlugins
public static void loadLatePlugins(java.awt.Component parent, java.util.Collection<PluginInformation> plugins, ProgressMonitor monitor)
Loads plugins frompluginswhich have the flagPluginInformation.earlyset to false.- Parameters:
parent- The parent component to be used for the displayed dialogplugins- the collection of pluginsmonitor- the progress monitor. Defaults toNullProgressMonitor.INSTANCEif null.
-
loadLocallyAvailablePluginInformation
@Nullable private static java.util.Map<java.lang.String,PluginInformation> loadLocallyAvailablePluginInformation(ProgressMonitor monitor)
Loads locally available plugin information from local plugin jars and from cached plugin lists.- Parameters:
monitor- the progress monitor. Defaults toNullProgressMonitor.INSTANCEif null.- Returns:
- the map of locally available plugin information, null in case of errors
-
alertMissingPluginInformation
private static void alertMissingPluginInformation(java.awt.Component parent, java.util.Collection<java.lang.String> plugins)
-
buildListOfPluginsToLoad
public static java.util.List<PluginInformation> buildListOfPluginsToLoad(java.awt.Component parent, ProgressMonitor monitor)
Builds the list of plugins to load. Deprecated and unmaintained plugins are filtered out. This involves user interaction. This method displays alert and confirmation messages.- Parameters:
parent- The parent component to be used for the displayed dialogmonitor- the progress monitor. Defaults toNullProgressMonitor.INSTANCEif null.- Returns:
- the list of plugins to load (as set of plugin names)
-
alertFailedPluginUpdate
private static void alertFailedPluginUpdate(java.awt.Component parent, java.util.Collection<PluginInformation> plugins)
-
findRequiredPluginsToDownload
private static java.util.Set<PluginInformation> findRequiredPluginsToDownload(java.util.Collection<PluginInformation> pluginsToUpdate, java.util.List<PluginInformation> allPlugins, java.util.Set<PluginInformation> pluginsToDownload)
-
updatePlugins
public static java.util.Collection<PluginInformation> updatePlugins(java.awt.Component parent, java.util.Collection<PluginInformation> pluginsWanted, ProgressMonitor monitor, boolean displayErrMsg)
Updates the plugins inplugins.- Parameters:
parent- the parent component for message boxespluginsWanted- the collection of plugins to update. Updates all plugins ifnullmonitor- the progress monitor. Defaults toNullProgressMonitor.INSTANCEif null.displayErrMsg- iftrue, a blocking error message is displayed in case of I/O exception.- Returns:
- the list of plugins to load
- Throws:
java.lang.IllegalArgumentException- if plugins is null
-
confirmDisablePlugin
public static boolean confirmDisablePlugin(java.awt.Component parent, java.lang.String reason, java.lang.String name)
Ask the user for confirmation that a plugin shall be disabled.- Parameters:
parent- The parent component to be used for the displayed dialogreason- the reason for disabling the pluginname- the plugin name- Returns:
- true, if the plugin shall be disabled; false, otherwise
-
getPlugin
public static java.lang.Object getPlugin(java.lang.String name)
Returns the plugin of the specified name.- Parameters:
name- The plugin name- Returns:
- The plugin of the specified name, if installed and loaded, or
nullotherwise.
-
getPluginClassLoader
public static PluginClassLoader getPluginClassLoader(java.lang.String name)
Returns the plugin class loader for the plugin of the specified name.- Parameters:
name- The plugin name- Returns:
- The plugin class loader for the plugin of the specified name, if
installed and loaded, or
nullotherwise. - Since:
- 12323
-
addDownloadSelection
public static void addDownloadSelection(java.util.List<DownloadSelection> downloadSelections)
Called in the download dialog to give the plugins a chance to modify the list of bounding box selectors.- Parameters:
downloadSelections- list of bounding box selectors
-
getPreferenceSetting
public static java.util.Collection<PreferenceSettingFactory> getPreferenceSetting()
Returns the list of plugin preference settings.- Returns:
- the list of plugin preference settings
-
installDownloadedPlugins
public static void installDownloadedPlugins(java.util.Collection<PluginInformation> pluginsToLoad, boolean dowarn)
Installs downloaded plugins. Moves files with the suffix ".jar.new" to the corresponding ".jar" files.If
dowarnis true, this methods emits warning messages on the console if a downloaded but not yet installed plugin .jar can't be be installed. Ifdowarnis false, the installation of the respective plugin is silently skipped.- Parameters:
pluginsToLoad- list of plugin informations to updatedowarn- if true, warning messages are displayed; false otherwise- Since:
- 13294
-
isValidJar
public static boolean isValidJar(java.io.File jar)
Determines if the specified file is a valid and accessible JAR file.- Parameters:
jar- The file to check- Returns:
- true if file can be opened as a JAR file.
- Since:
- 5723
-
findUpdatedJar
public static java.io.File findUpdatedJar(java.lang.String name)
Replies the updated jar file for the given plugin name.- Parameters:
name- The plugin name to find.- Returns:
- the updated jar file for the given plugin name. null if not found or not readable.
- Since:
- 5601
-
refreshLocalUpdatedPluginInfo
public static void refreshLocalUpdatedPluginInfo(java.util.Collection<PluginInformation> updatedPlugins)
Refreshes the given PluginInformation objects with new contents read from their corresponding jar file.- Parameters:
updatedPlugins- The PluginInformation objects to update.- Since:
- 5601
-
askUpdateDisableKeepPluginAfterException
private static int askUpdateDisableKeepPluginAfterException(PluginProxy plugin)
-
getPluginCausingException
private static PluginProxy getPluginCausingException(java.lang.Throwable ex)
Replies the plugin which most likely threw the exceptionex.- Parameters:
ex- the exception- Returns:
- the plugin; null, if the exception probably wasn't thrown from a plugin
-
updateOrdisablePluginAfterException
public static PluginDownloadTask updateOrdisablePluginAfterException(java.lang.Throwable e)
Checks whether the exceptionewas thrown by a plugin. If so, conditionally updates or deactivates the plugin, but asks the user first.- Parameters:
e- the exception- Returns:
- plugin download task if the plugin has been updated to a newer version,
nullif it has been disabled or kept as it
-
getBugReportInformation
public static java.util.Collection<java.lang.String> getBugReportInformation()
Returns the list of loaded plugins as aStringto be displayed in status report. Useful for bug reports.- Returns:
- The list of loaded plugins
-
getInfoPanel
public static javax.swing.JPanel getInfoPanel()
Returns the list of loaded plugins as aJPanelto be displayed in About dialog.- Returns:
- The list of loaded plugins (one "line" of Swing components per plugin)
-
getDeprecatedAndUnmaintainedPlugins
public static java.util.Set<java.lang.String> getDeprecatedAndUnmaintainedPlugins()
Returns the set of deprecated and unmaintained plugins.- Returns:
- set of deprecated and unmaintained plugins names.
- Since:
- 8938
-
removePlugins
public static boolean removePlugins(java.util.List<PluginInformation> deactivatedPlugins)
Remove deactivated plugins, returning true if JOSM should restart- Parameters:
deactivatedPlugins- The plugins to deactivate- Returns:
- true if there was a plugin that requires a restart
- Since:
- 15508
-
-