Home
Categories
Dictionary
Download
Project Details
Changes Log
Tutorials
FAQ
License

Plugins activation



The activation of the plugins is performed through several ordered steps, which depend on if the application has a UI or not.

Each of these steps will be performed for each Plugin, so a step will be performed for all Plugins before going on to the next step.

Overview

Activation for non UI applications

For an application which has no UI:
  1. Instanciation of the Plugins
  2. Getting the Plugins properties, allowing to get the dependencies between Plugins. After this step, Plugins which have declared dependencies on other Plugins but for which some of the Plugins on which they depend are not present will be discarded
  3. After this step, the plugins initialization order will be used for the remaining steps of the process
  4. Register the Plugins, allowing to declare the Plugin in the framework
  5. If a Configuration manager exists for the application, Deserialize the Plugin configuration
  6. Initialize the Plugins
  7. Reset the Plugin settings

initprocess

Activation for UI applications

For an application which has an UI:
  1. Instanciation of the Plugins
  2. Getting the Plugins properties, allowing to get the dependencies between Plugins. After this step, Plugins which have declared dependencies on other Plugins but for which some of the Plugins on which they depend are not present will be discarded
  3. After this step, the plugins initialization order will be used for the remaining steps of the process
  4. Register the Plugins, allowing to declare the Plugin in the framework
  5. If a Configuration manager exists for the application, Deserialize the Plugins configuration
  6. Initialize the Plugins
  7. For all GUI Plugins (instances of GUI Plugins), initialize the Plugin GUI
  8. Reset the Plugin settings

initprocessui

Plugins instanciation

The Plugins which are specified in the plugins directory or directories are instanciated in the following condition:
  • Their manifest must specify the MDIPluginClass which will be instanciated. Note that it is safe to have other jar files in the directory because files which do not have the MDIPluginClass property in their manifest won't be loaded.
After the instanciation and for each Plugin, the Plugin name is retrieved:
  • If the name belongs to another Plugin previously processed in this step, it will be discarded
  • If the Plugin has been disabled in the application Plugin interface, it will be discarded

Getting the Plugin properties

Main Article: Plugin properties

To retrieve the characteristics of each Plugin, the Plugin.getProperty(Object) is called by the application PluginsManager.

The properties in particular allows to specify the Plugins on which each Plugin depends on. If one of the Plugins on which a Plugins depends on is not present or is disabled, the dependent Plugin will be disabled.

The dependency list of Plugins will determine the plugins initialization order for the remaining steps of the process.

Registering the Plugins

Registering a Plugin is performed through the Plugin.register(MDIApplication) method. The Plugin is not required to perform anything in this method, but it allows to pass the application to the Plugin.

Serializing and deserializing the Plugins configuration

Main Article: Plugins configuration

The configuration for a Plugin will be automatically retrieved by the application by calling the Plugin.getPluginConfiguration() method. By default this method returns null, which means that the Plugin has no configuration.

For example:
  public class OpenImagePlugin extends AbstractMDIPlugin {
      
    public OpenImagePlugin() {
    }   
      
    public Configuration getPluginConfiguration() {
      return MyConfiguration.getInstance();
    }           

Initializing the Plugins

Initializing the Plugin is performed through the Plugin.init(MDIApplication) method. The Plugin is not required to perform anything in this method.

You can perform initialization for the Plugin in both the register or the init method.


You can also perform GUI initialization in these methods but you will need to take care of the Thread in which you execute the code by yourself. It can be easier to perform GUI initialization in the AbstractMDIPlugin.initializeUIImpl() method which be called automatically in the Plugins GUI initializing step

Reset the Plugin settings

The Plugin.resetSettings() method is called during the Plugins activation. It is up to the Plugin to decide what to do.

The order in which this step is performed depends if the applilcation is a GUI application or not. If the application has an UI, then this step will be performed in the EDT or Platform Thread after the Plugins GUI has been initialized.

Initializing the Plugins GUI

The MDIPlugin.initAfterGUI(MDIApplication) method will be called GUI applications for each Plugin In the EDT or Platform Thread (which means that you don't need to take care of the Thread yourself in the Plugin).

The initAfterGUI method will call by default the AbstractMDIPlugin.initializeUIImpl() method so you can either:

Initializing GUI options

By default the method will be called for all GUI Plugins In the EDT or Platform Thread in a non blocking process. However you can customize how the call is performed by the plugins Manager by setting the mode in the AbstractApplication.initConfiguration(Preferences, short): By default the INIT_EDT_NOT_BLOCKING mode will be used. It will be the case if you use the AbstractApplication.initConfiguration(Preferences) (which is, without specifying the mode).

This mode is used for the list of all calls for each GUI Plugin. It means that if several Plugins perform a GUI Initialization in the initializeUIImpl method, their initialization order will still be respected for all modes.

See also


Categories: javafx | plugins | swing

Copyright 2006-2023 Herve Girod. All Rights Reserved. Documentation and source under the LGPL v2 and Apache 2.0 licences