Plugins register
EBComponent
instances with the
EditBus
to receive messages reflecting
changes in jEdit's state.
The message
classes derived from
EBMessage
cover the opening
and closing of the application, changes in the status of buffers and views,
changes in user settings, as well as changes in
the state of other program features. A full list of messages can be found in the
org.gjt.sp.jedit.msg
package.
EBComponent
s are added and removed with the
EditBus.addToBus()
and
EditBus.removeFromBus()
methods.
Typically, the
EBComponent.handleMessage()
method
is implemented with one or more if
blocks that test
whether the message is an instance of a derived message class in
which the component has an interest.
if(msg instanceof BufferUpdate) { // a buffer's state has changed! } else if(msg instanceof ViewUpdate) { // a view's state has changed! } // ... and so on
If a plugin core class will respond to EditBus
messages, it can be derived from
EBPlugin
, in which case no explicit
addToBus()
call is necessary.
Otherwise,
EditPlugin
will suffice as a
plugin base class. Note that QuickNotepad uses the latter.