Plugin is the base abstract class for any modeling tool plugin. See the following figure:
A plugin written by a user must be extended from this class. Every plugin has its own descriptor set by a plugin's manager. A plugin has three special methods:
- a public abstract void init() method is called on a program startup. The plugin must override this method and implement its own functionality there.
- a public abstract boolean close() method is called on a program exit. The plugin must override this method and return the value true if the plugin is ready to exit. In other case, it should return the value false. If the plugin returns false, the program exit is canceled.
- a public abstract boolean isSupported() method is called before the plugin initialization. If this method returns false, the plugin is not initialized. isSupported() may be used to check if the plugin can be started, for example, on this OS.
Use com.nomagic.magicdraw.plugins.PluginUtils to get references to loaded plugins. This is useful if you have dependencies among plugins and want to get a reference to other plugin object.
PluginDescriptor is the class that provides information loaded from the plugin.xml file (a plugin descriptor) to the plugin.
More information is available in javadoc.