projectviewer.config
Class ExtensionManager

java.lang.Object
  extended by projectviewer.config.ExtensionManager

public class ExtensionManager
extends java.lang.Object

A central location for managing ProjectViewer extensions (deployed as jEdit services). Allows for instantiation, cleanup, configuration for enabling/disabling extensions, etc.

Since:
PV 3.0.0
Author:
Marcelo Vanzin

Nested Class Summary
static interface ExtensionManager.ManagedService
          Classes that use extensions should implement this interface and register themselves by calling register(ManagedService), to receive events about changes in the service configuration.
 
Method Summary
static ExtensionManager getInstance()
           
 java.util.List<ExtensionManager.ManagedService> getServices()
          Returns the list of registered services.
 java.util.List<java.lang.Object> loadExtensions(java.lang.Class clazz)
          Returns the extensions that implement the given service class.
 void register(ExtensionManager.ManagedService service)
          Registers the given managed service with the manager.
 void reloadExtensions()
          Called by the PV plugin instance to refresh the extensions of all the currently registered managed services.
 void unregister(ExtensionManager.ManagedService service)
          Unregisters the given managed service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ExtensionManager getInstance()

getServices

public java.util.List<ExtensionManager.ManagedService> getServices()
Returns the list of registered services.

Returns:
A list of services.

register

public void register(ExtensionManager.ManagedService service)
Registers the given managed service with the manager. The manager keeps weak references to the services it monitors, so make sure that the service instance is not garbage-collected, otherwise it won't be notified of updates.


unregister

public void unregister(ExtensionManager.ManagedService service)
Unregisters the given managed service.


reloadExtensions

public void reloadExtensions()
Called by the PV plugin instance to refresh the extensions of all the currently registered managed services.


loadExtensions

public java.util.List<java.lang.Object> loadExtensions(java.lang.Class clazz)
Returns the extensions that implement the given service class. The returned list is pruned to only include services that were not disabled by the user.