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

Difference between revisions of "Corona HowTo Event Handler Extension Point"

 
m (obsolete)
 
Line 1: Line 1:
<table border='1' cellpadding='3'>
 
<tr>
 
<td>[http://www.eclipse.org/corona Eclipse Home]</td>
 
<td>[[Corona|Wiki Home]]</td>
 
<td>[[Corona Development|Development]]</td>
 
<td>[[Corona HowTo|How To...]]</td>
 
</tr>
 
</table>
 
----
 
==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
 
## Select the ''class*'' link to create the event handler class using the wizard
 
### Create the ''SampleEventHandler'' class
 
#### Ensure that it extends ''AbstractContextContainerEventHandler''
 
## 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.
 

Latest revision as of 10:53, 27 February 2008

Back to the top