if ((delegate instanceof IActionDelegate2)
&& (trigger instanceof Event)) {
// This supports Eclipse 2.1 to Eclipse 3.1.
final IActionDelegate2 delegate2 = (IActionDelegate2) delegate;
final Event triggeringEvent = (Event) trigger;
delegate2.runWithEvent(action, triggeringEvent);
} else if ((delegate instanceof IActionDelegateWithEvent)
&& (trigger instanceof Event)) {
// This supports Eclipse 2.0
final IActionDelegateWithEvent delegateWithEvent = (IActionDelegateWithEvent) delegate;
final Event triggeringEvent = (Event) trigger;