Home
Categories
Dictionary
Download
Project Details
Changes Log
Tutorials
FAQ
License

Plugins dependencies



The Plugin.getProperty(Object) is called by the PluginsManager to retrieve a Plugin characteristics.

The PluginElementTypes.PROPERTY_DEPEND property allows to specify other plugins (by their name) on which the Plugin depend on. It can contain a single String or a List of Strings.

If one of the Plugins on which a Plugins depends on is not present or is disabled, the dependent Plugin will be disabled.

Result on the Plugins initialization order


If a plugin depends on another plugin, it will be put after the plugin on which it depend on in the initialization order.

Examples

Example with one dependency

In the following example, the "MyPlugin" Plugin depend on the "masterPlugin" Plugin:
   public String getPluginName() {
     return "MyPlugin";
   }

   public Object getPluginProperty(String prop) {
     if (prop.equals(PluginElementTypes.PROPERTY_DATE)) {
       return "26/07/2016";
     } else if (prop.equals(PluginElementTypes.PROPERTY_DESC)) {
       return "My Plugin description";
     } else if (prop.equals(PluginElementTypes.PROPERTY_VERSION)) {
       return "1.0";
     } else if (prop.equals(PluginElementTypes.PROPERTY_DEPEND)) {
       return "masterPlugin";
     }
   }      

Example with several dependencies

In the following example, the "MyPlugin" Plugin depend on the "masterPlugin" and "masterPlugin2" Plugins:
   public String getPluginName() {
     return "MyPlugin";
   }

   public Object getPluginProperty(String prop) {
     if (prop.equals(PluginElementTypes.PROPERTY_DATE)) {
       return "26/07/2016";
     } else if (prop.equals(PluginElementTypes.PROPERTY_DESC)) {
       return "My Plugin description";
     } else if (prop.equals(PluginElementTypes.PROPERTY_VERSION)) {
       return "1.0";
     } else if (prop.equals(PluginElementTypes.PROPERTY_DEPEND)) {
       List list = Arrays.asList(new String[]{"masterPlugin", "masterPlugin2"});
       return list;
     }
   }      

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