org.gjt.sp.jedit
Class EditPlugin

java.lang.Object
  |
  +--org.gjt.sp.jedit.EditPlugin
Direct Known Subclasses:
EBPlugin, EditPlugin.Broken

public abstract class EditPlugin
extends java.lang.Object

The abstract base class that every plugin must implement.

Each plugin must have the following properties defined in its property file:

The following properties are optional but recommended: Plugin dependencies are also specified using properties. Each dependency is defined in a property named with plugin.class name.depend. followed by a number. Dependencies must be numbered in order, starting from zero.

The value of a dependency property has one of the following forms:

Here is an example set of plugin properties:
plugin.QuickNotepadPlugin.name=QuickNotepad
plugin.QuickNotepadPlugin.author=John Gellene
plugin.QuickNotepadPlugin.version=4.1
plugin.QuickNotepadPlugin.docs=QuickNotepad.html
plugin.QuickNotepadPlugin.depend.0=jedit 04.01.01.00
Note that in all cases above where a class name is needed, the fully qualified class name, including the package name, if any, must be used.

Alternatively, instead of extending this class, a plugin core class can extend EBPlugin to automatically receive EditBus messages.

Since:
jEdit 2.1pre1
Version:
$Id: EditPlugin.java,v 1.13 2003/02/11 02:31:06 spestov Exp $
Author:
Slava Pestov, John Gellene (API documentation)
See Also:
jEdit.getProperty(String), jEdit.getPlugin(String), jEdit.getPlugins(), jEdit.getPluginJAR(String), jEdit.getPluginJARs()

Nested Class Summary
static class EditPlugin.Broken
          A placeholder for a plugin that didn't load.
static class EditPlugin.JAR
          A JAR file.
 
Constructor Summary
EditPlugin()
           
 
Method Summary
 void createMenuItems(java.util.Vector menuItems)
          When a View object is created, it calls this method on each plugin class to obtain entries to be displayed in the view's Plugins menu.
 void createOptionPanes(OptionsDialog optionsDialog)
          When the Global Options dialog is opened, this method is called for each plugin in turn.
 java.lang.String getClassName()
          Returns the plugin's class name.
 EditPlugin.JAR getJAR()
          Returns the JAR file containing this plugin.
 void start()
          The jEdit startup routine calls this method for each loaded plugin.
 void stop()
          The jEdit exit routine calls this method fore ach loaded plugin.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EditPlugin

public EditPlugin()
Method Detail

start

public void start()
The jEdit startup routine calls this method for each loaded plugin. This method should return as quickly as possible to avoid slowing down jEdit startup.

The default implementation does nothing.

Since:
jEdit 2.1pre1

stop

public void stop()
The jEdit exit routine calls this method fore ach loaded plugin. If a plugin uses state information or other persistent data that should be stored in a special format, this would be a good place to write the data to storage. If the plugin uses jEdit's properties API to hold settings, no special processing is needed for them on exit, since they will be saved automatically.

The default implementation does nothing.

Since:
jEdit 2.1pre1

createMenuItems

public void createMenuItems(java.util.Vector menuItems)
When a View object is created, it calls this method on each plugin class to obtain entries to be displayed in the view's Plugins menu. The menuItems vector accumulates menu items and menus as it is passed from plugin to plugin.

The easiest way to provide menu items is to package them as entries in the plugin's property file and implement createMenuItems() with a call to the GUIUtilities.loadMenu(String) method:

public void createMenuItems(Vector menuItems)
{
    menuItems.addElement(GUIUtilities.loadMenu(
        "myplugin.menu"));
}
Alternatively, GUIUtilities.loadMenuItem(String) can be used if your plugin only defines one menu item.

The default implementation does nothing.

Parameters:
menuItems - Add menus and menu items here.
Since:
jEdit 2.6pre5
See Also:
GUIUtilities.loadMenu(String), GUIUtilities.loadMenuItem(String)

createOptionPanes

public void createOptionPanes(OptionsDialog optionsDialog)
When the Global Options dialog is opened, this method is called for each plugin in turn. To show an option pane, the plugin should define an option pane class and implement createOptionPane() as follows:
public void createOptionPanes(OptionsDialog optionsDialog)
{
    dialog.addOptionPane(new MyPluginOptionPane());
}
Plugins can also define more than one option pane, grouped in an "option group". See the documentation for the OptionGroup class for information.

The default implementation does nothing.

Parameters:
optionsDialog - The plugin options dialog box
Since:
jEdit 2.1pre1
See Also:
OptionPane, AbstractOptionPane, OptionsDialog.addOptionPane(OptionPane), OptionGroup, OptionsDialog.addOptionGroup(OptionGroup)

getClassName

public java.lang.String getClassName()
Returns the plugin's class name.

Since:
jEdit 2.5pre3

getJAR

public EditPlugin.JAR getJAR()
Returns the JAR file containing this plugin.

Since:
jEdit 3.1pre5