How Plugins are Loaded

We will discuss the implementation of the QuickNotepad plugin, along with the jEdit APIs it makes use of. But first, we describe how plugins are loaded.

As part of its startup routine, jEdit's main method calls various methods to load and initialize plugins.

Plugin loading occurs after jEdit has loaded application properties, any user-supplied properties, and the application's set of actions that will be available from jEdit's menu bar (as well as the toolbar and keyboard shortcuts).

Plugin loading occurs before jEdit opens the initial view or loads any files for editing. It also occurs before jEdit runs any startup scripts.

Plugins are loaded from files with the .jar filename extension located in the jars subdirectories of the jEdit installation and user settings directories (see the section called “The jEdit Settings Directory”).

For each JAR archive file it finds, jEdit scans its entries and performs the following tasks:

After scanning the plugin JAR file and loading any resources, a new instance of the plugin core class is created and added to the collection maintained by the appropriate EditPlugin.JAR. jEdit then calls the start() method of the plugin core class. The start() method can perform initialization of the object's data members. Because this method is defined as an empty “no-op” in the EditPlugin abstract class, a plugin need not provide an implementation if no unique initialization is required.