Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Corona HowTo Event Handler Extension Point
Revision as of 09:55, 9 January 2007 by Dennis.oflynn.compuware.com (Talk | contribs)
Eclipse Home | Wiki Home | Development | How To... |
ContextContainer Event Handler via Extension Point
ContextContainer events are processed using event handlers. There are two two ways to define an event handler for ContextContainer events: using the eventhandler extension point and registering an event handler with the ContextContainerEventManager.
All event handlers extend the abstract class AbstractContextContainerEventHandler. This class enables each event handler to process its events within its own Eclipse job within a background thread. An optional event filter can be specified to handle only those events of interest.
The following describes how to create a ContextContainer event handler by using the eventhandler extension point.
Define the Extension
- Create a new sample plug-in project named org.eclipse.corona.sample.eventhandler
- Update the plug-in's plugin.xml using the PDE editor
- Create a plug-in dependency on org.eclipse.corona.container
- Create an extension of the org.eclipse.corona.container.eventhandler extension point
- Create a new eventhandler from the extension point
- Define the event handler's name: SampleEventHandler
- Define the event handler's class: org.eclipse.corona.sample.eventhandler.SampleEventHandler
- Leave the optional filter attribute blank
- Create a new eventhandler from the extension point
- Select the class* link to create the event handler class using the wizard
- Create the SampleEventHandler class
- Ensure that it extends AbstractContextContainerEventHandler
- Create the SampleEventHandler class
- Implement the event handler's required methods
- getID() - is used to identify the event handler
- eventThread() - is the Eclipse job thread where the event handling takes place.