|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openstreetmap.josm.plugins.PluginHandler
public class PluginHandler
PluginHandler is basically a collection of static utility functions used to bootstrap and manage the loaded plugins.
| Nested Class Summary | |
|---|---|
static class |
PluginHandler.DeprecatedPlugin
|
private static class |
PluginHandler.UpdatePluginsMessagePanel
|
| Field Summary | |
|---|---|
static int |
DEFAULT_TIME_BASED_UPDATE_INTERVAL
Default time-based update interval, in days (pluginmanager.time-based-update.interval) |
static java.util.Collection<PluginHandler.DeprecatedPlugin> |
DEPRECATED_PLUGINS
deprecated plugins that are removed on start |
static java.util.Collection<PluginProxy> |
pluginList
All installed and loaded plugins (resp. |
private static java.util.List<java.lang.ClassLoader> |
sources
Add here all ClassLoader whose resource should be searched. |
static java.lang.String[] |
UNMAINTAINED_PLUGINS
|
| Constructor Summary | |
|---|---|
PluginHandler()
|
|
| Method Summary | |
|---|---|
static void |
addDownloadSelection(java.util.List<DownloadSelection> downloadSelections)
|
private static void |
alertFailedPluginUpdate(java.awt.Component parent,
java.util.Collection<PluginInformation> plugins)
|
private static void |
alertJOSMUpdateRequired(java.awt.Component parent,
java.lang.String plugin,
int requiredVersion)
|
private static void |
alertMissingPluginInformation(java.awt.Component parent,
java.util.Collection<java.lang.String> plugins)
|
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 |
static java.util.List<PluginInformation> |
buildListOfPluginsToLoad(java.awt.Component parent,
ProgressMonitor monitor)
Builds the set of plugins to load. |
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. |
static boolean |
checkLoadPreconditions(java.awt.Component parent,
java.util.Collection<PluginInformation> plugins,
PluginInformation plugin)
Checks whether all preconditions for loading the plugin plugin are met. |
static boolean |
checkRequiredPluginsPreconditions(java.awt.Component parent,
java.util.Collection<PluginInformation> plugins,
PluginInformation plugin)
Checks if required plugins preconditions for loading the plugin plugin are met. |
private static boolean |
confirmDeactivatingPluginAfterException(PluginProxy plugin)
|
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. |
static java.lang.ClassLoader |
createClassLoader(java.util.Collection<PluginInformation> plugins)
Creates a class loader for loading plugin code. |
static void |
disablePluginAfterException(java.lang.Throwable e)
Checks whether the exception e was thrown by a plugin. |
private static void |
filterDeprecatedPlugins(java.awt.Component parent,
java.util.Collection<java.lang.String> plugins)
Removes deprecated plugins from a collection of plugins. |
private static void |
filterUnmaintainedPlugins(java.awt.Component parent,
java.util.Collection<java.lang.String> plugins)
Removes unmaintained plugins from a collection of plugins. |
static java.lang.String |
getBugReportText()
|
static javax.swing.JPanel |
getInfoPanel()
|
static java.lang.Object |
getPlugin(java.lang.String name)
|
private static PluginProxy |
getPluginCausingException(java.lang.Throwable ex)
Replies the plugin which most likely threw the exception ex. |
static void |
getPreferenceSetting(java.util.Collection<PreferenceSettingFactory> settings)
|
static java.util.Collection<java.lang.ClassLoader> |
getResourceClassLoaders()
|
static void |
installDownloadedPlugins(boolean dowarn)
Installs downloaded plugins. |
static void |
loadEarlyPlugins(java.awt.Component parent,
java.util.Collection<PluginInformation> plugins,
ProgressMonitor monitor)
Loads plugins from plugins which have the flag PluginInformation.early
set to true. |
static void |
loadLatePlugins(java.awt.Component parent,
java.util.Collection<PluginInformation> plugins,
ProgressMonitor monitor)
Loads plugins from plugins which have the flag PluginInformation.early
set 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. |
static void |
loadPlugin(java.awt.Component parent,
PluginInformation plugin,
java.lang.ClassLoader pluginClassLoader)
Loads and instantiates the plugin described by plugin using
the class loader pluginClassLoader. |
static void |
loadPlugins(java.awt.Component parent,
java.util.Collection<PluginInformation> plugins,
ProgressMonitor monitor)
Loads the plugin in plugins from locally available jar files into
memory. |
static void |
notifyMapFrameChanged(MapFrame old,
MapFrame map)
Notified loaded plugins about a new map frame |
static java.util.List<PluginInformation> |
updatePlugins(java.awt.Component parent,
java.util.List<PluginInformation> plugins,
ProgressMonitor monitor)
Updates the plugins in plugins. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.util.Collection<PluginHandler.DeprecatedPlugin> DEPRECATED_PLUGINS
public static final java.lang.String[] UNMAINTAINED_PLUGINS
public static final int DEFAULT_TIME_BASED_UPDATE_INTERVAL
public static final java.util.Collection<PluginProxy> pluginList
private static final java.util.List<java.lang.ClassLoader> sources
| Constructor Detail |
|---|
public PluginHandler()
| Method Detail |
|---|
public static java.util.Collection<java.lang.ClassLoader> getResourceClassLoaders()
private static void filterDeprecatedPlugins(java.awt.Component parent,
java.util.Collection<java.lang.String> plugins)
plugins.
Also notifies the user about removed deprecated plugins
parent - The parent Component used to display warning popupplugins - the collection of plugins
private static void filterUnmaintainedPlugins(java.awt.Component parent,
java.util.Collection<java.lang.String> plugins)
plugins. 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.
plugins - the collection of pluginspublic static boolean checkAndConfirmPluginUpdate(java.awt.Component parent)
parent - the parent component relative to which the confirmation dialog
is to be displayed
private static void alertMissingRequiredPlugin(java.awt.Component parent,
java.lang.String plugin,
java.util.Set<java.lang.String> missingRequiredPlugin)
parent - The parent Component used to display error popupplugin - the pluginmissingRequiredPlugin - the missing required plugin
private static void alertJOSMUpdateRequired(java.awt.Component parent,
java.lang.String plugin,
int requiredVersion)
public static boolean checkLoadPreconditions(java.awt.Component parent,
java.util.Collection<PluginInformation> plugins,
PluginInformation plugin)
plugin are met. The
current JOSM version must be compatible with the plugin and no other plugins this plugin
depends on should be missing.
parent - The parent Component used to display error popupplugins - the collection of all loaded pluginsplugin - the plugin for which preconditions are checked
public static boolean checkRequiredPluginsPreconditions(java.awt.Component parent,
java.util.Collection<PluginInformation> plugins,
PluginInformation plugin)
plugin are met.
No other plugins this plugin depends on should be missing.
parent - The parent Component used to display error popupplugins - the collection of all loaded pluginsplugin - the plugin for which preconditions are checked
public static java.lang.ClassLoader createClassLoader(java.util.Collection<PluginInformation> plugins)
plugins - the collection of plugins which are going to be loaded with this
class loader
public static void loadPlugin(java.awt.Component parent,
PluginInformation plugin,
java.lang.ClassLoader pluginClassLoader)
plugin using
the class loader pluginClassLoader.
plugin - the pluginpluginClassLoader - the plugin class loader
public static void loadPlugins(java.awt.Component parent,
java.util.Collection<PluginInformation> plugins,
ProgressMonitor monitor)
plugins from locally available jar files into
memory.
plugins - the list of pluginsmonitor - the progress monitor. Defaults to NullProgressMonitor.INSTANCE if null.
public static void loadEarlyPlugins(java.awt.Component parent,
java.util.Collection<PluginInformation> plugins,
ProgressMonitor monitor)
plugins which have the flag PluginInformation.early
set to true.
plugins - the collection of pluginsmonitor - the progress monitor. Defaults to NullProgressMonitor.INSTANCE if null.
public static void loadLatePlugins(java.awt.Component parent,
java.util.Collection<PluginInformation> plugins,
ProgressMonitor monitor)
plugins which have the flag PluginInformation.early
set to false.
plugins - the collection of pluginsmonitor - the progress monitor. Defaults to NullProgressMonitor.INSTANCE if null.private static java.util.Map<java.lang.String,PluginInformation> loadLocallyAvailablePluginInformation(ProgressMonitor monitor)
monitor - the progress monitor. Defaults to NullProgressMonitor.INSTANCE if null.
private static void alertMissingPluginInformation(java.awt.Component parent,
java.util.Collection<java.lang.String> plugins)
public static java.util.List<PluginInformation> buildListOfPluginsToLoad(java.awt.Component parent,
ProgressMonitor monitor)
monitor - the progress monitor. Defaults to NullProgressMonitor.INSTANCE if null.
private static void alertFailedPluginUpdate(java.awt.Component parent,
java.util.Collection<PluginInformation> plugins)
public static java.util.List<PluginInformation> updatePlugins(java.awt.Component parent,
java.util.List<PluginInformation> plugins,
ProgressMonitor monitor)
throws java.lang.IllegalArgumentException
plugins.
parent - the parent component for message boxesplugins - the collection of plugins to update. Must not be null.monitor - the progress monitor. Defaults to NullProgressMonitor.INSTANCE if null.
java.lang.IllegalArgumentException - thrown if plugins is null
public static boolean confirmDisablePlugin(java.awt.Component parent,
java.lang.String reason,
java.lang.String name)
reason - the reason for disabling the pluginname - the plugin name
public static void notifyMapFrameChanged(MapFrame old,
MapFrame map)
old - the old map framemap - the new map framepublic static java.lang.Object getPlugin(java.lang.String name)
public static void addDownloadSelection(java.util.List<DownloadSelection> downloadSelections)
public static void getPreferenceSetting(java.util.Collection<PreferenceSettingFactory> settings)
public static void installDownloadedPlugins(boolean dowarn)
dowarn is true, this methods emits warning messages on the console if a downloaded
but not yet installed plugin .jar can't be be installed. If dowarn is false, the
installation of the respective plugin is sillently skipped.
dowarn - if true, warning messages are displayed; false otherwiseprivate static boolean confirmDeactivatingPluginAfterException(PluginProxy plugin)
private static PluginProxy getPluginCausingException(java.lang.Throwable ex)
ex.
ex - the exception
public static void disablePluginAfterException(java.lang.Throwable e)
e was thrown by a plugin. If so,
conditionally deactivates the plugin, but asks the user first.
e - the exceptionpublic static java.lang.String getBugReportText()
public static javax.swing.JPanel getInfoPanel()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||