Package projectviewer.event

Event Handling.

See:
          Description

Interface Summary
ProjectListener A project listener.
ProjectViewerListener A listener for ProjectViewerEvents.
 

Class Summary
ProjectAdapter Default implementation of the listener interface that does nothing when the methods are called.
ProjectEvent A project event.
ProjectViewerAdapter Default implementation of the ProjectViewerListener.
ProjectViewerEvent A project viewer event.
 

Package projectviewer.event Description

Event Handling.

The Project Viewer plugin provides a different interface for each open jEdit view, so the user can work with different projects in different views. This is useful for PV's purposes, but some plugins may not benefit from such a dependence.

For this reason, the event notification provided by PV can be used by either kind of plugins. The addProjectViewerListener() in class ProjectViewer provides a way for both types of plugin to register for PV events.

To register listeners for an EditPlugin-derived class called className using the new API, create the following properties:

Event notification works differently for plugins that rely on jEdit's views and for those that do not. For plugins that are view-dependent (which means, generally, that there is an instance of some class for each open jEdit view, just like the ProjectViewer class), these events are only fired when a project is loaded into that particular instance of PV in that view. Changes in other views will not fire any events for that listener.

For plugins that do not take into account the current active view, events are fired more oftenly. Any event being fired in any view will be sent to these listeners. Also, when the current view is changed (i.e., the user starts working on another view), an event is fired saying that the project currently active in that view has been activated.

These events can be very useful for plugins that want integration with some aspect of a project. For example, a plugin may want to display information about some build file for the project, so each time a project is changed the information displayed changes. Or maybe the plugin can use different properties for different projects. For more complex interaction with the ProjectViewer plugin, please read the other documentation linked at the beginning of this document.

Project Events

Plugins may register themselves to receive notification about changes to a project instead of changes in the state of the ProjectViewer. To accomplish this, the plugin class itself should implement the ProjectListener interface, and register the listener in the project class.

The pre-4.2 way of doing this was by calling the addProjectListener() method. Then, it was up to the plugin to detect project changes and add/remove the listeners.

To register project listeners using the new API, create the following property: