org.eclipse.emf.transaction
Class TriggerListener

java.lang.Object
  extended byorg.eclipse.emf.transaction.ResourceSetListenerImpl
      extended byorg.eclipse.emf.transaction.TriggerListener
All Implemented Interfaces:
java.util.EventListener, ResourceSetListener

public abstract class TriggerListener
extends ResourceSetListenerImpl

A convenient superclass for listeners that implement "triggers" to process Notifications one at a time, generating a command for each that will make dependent updates to the model.


Constructor Summary
TriggerListener()
          Initializes me with the default filter.
TriggerListener(NotificationFilter filter)
          Initializes me with the specified filter.
 
Method Summary
 boolean isPrecommitOnly()
          I want only ppre-commit events, not post-commit events.
 org.eclipse.emf.common.command.Command transactionAboutToCommit(ResourceSetChangeEvent event)
          Implements the trigger callback by processing the event's notifications one by one, delegating to the TriggerListener.trigger(org.eclipse.emf.transaction.TransactionalEditingDomain, org.eclipse.emf.common.notify.Notification) method for each to generate a command.
protected abstract  org.eclipse.emf.common.command.Command trigger(TransactionalEditingDomain domain, org.eclipse.emf.common.notify.Notification notification)
          Implemented by subclasses to provide a trigger command for a single change in the model.
 
Methods inherited from class org.eclipse.emf.transaction.ResourceSetListenerImpl
getFilter, isAggregatePrecommitListener, isPostcommitOnly, resourceSetChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TriggerListener

public TriggerListener()
Initializes me with the default filter.


TriggerListener

public TriggerListener(NotificationFilter filter)
Initializes me with the specified filter.

Parameters:
filter - a notification filter, or null for the default
Method Detail

transactionAboutToCommit

public org.eclipse.emf.common.command.Command transactionAboutToCommit(ResourceSetChangeEvent event)
                                                                throws RollbackException
Implements the trigger callback by processing the event's notifications one by one, delegating to the TriggerListener.trigger(org.eclipse.emf.transaction.TransactionalEditingDomain, org.eclipse.emf.common.notify.Notification) method for each to generate a command. The commands created by the subclass are chained in the order that they are received from the subclass.

Specified by:
transactionAboutToCommit in interface ResourceSetListener
Overrides:
transactionAboutToCommit in class ResourceSetListenerImpl
Returns:
a composite of the commands returned by the subclass implementation of the TriggerListener.trigger(org.eclipse.emf.transaction.TransactionalEditingDomain, org.eclipse.emf.common.notify.Notification) method
Throws:
RollbackException

trigger

protected abstract org.eclipse.emf.common.command.Command trigger(TransactionalEditingDomain domain,
                                                                  org.eclipse.emf.common.notify.Notification notification)
Implemented by subclasses to provide a trigger command for a single change in the model.

Parameters:
domain - the editing domain
notification - the notification describing a change in the model
Returns:
the command, or null if none is required for this particular notification

isPrecommitOnly

public boolean isPrecommitOnly()
I want only ppre-commit events, not post-commit events.

Specified by:
isPrecommitOnly in interface ResourceSetListener
Overrides:
isPrecommitOnly in class ResourceSetListenerImpl

Copyright 2002, 2006 IBM Corporation and others.
All Rights Reserved.