Skip to main content

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.

Jump to: navigation, search

Corona HowTo Event Handler Extension Point

Revision as of 09:55, 9 January 2007 by Dennis.oflynn.compuware.com (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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

  1. Create a new sample plug-in project named org.eclipse.corona.sample.eventhandler
  2. Update the plug-in's plugin.xml using the PDE editor
    1. Create a plug-in dependency on org.eclipse.corona.container
    2. Create an extension of the org.eclipse.corona.container.eventhandler extension point
      1. Create a new eventhandler from the extension point
        1. Define the event handler's name: SampleEventHandler
        2. Define the event handler's class: org.eclipse.corona.sample.eventhandler.SampleEventHandler
        3. Leave the optional filter attribute blank
    3. Select the class* link to create the event handler class using the wizard
      1. Create the SampleEventHandler class
        1. Ensure that it extends AbstractContextContainerEventHandler
    4. Implement the event handler's required methods
      1. getID() - is used to identify the event handler
      2. eventThread() - is the Eclipse job thread where the event handling takes place.

Back to the top