org.eclipse.emf.ecp.changebroker.spi
Interface ChangeBroker

All Known Implementing Classes:
ChangeBrokerImpl

public interface ChangeBroker

A Change Broker maintains sets of observers. Based on incoming notifications it forwards the notification to the observers based on strategies.

There are two kinds of observers: regular EMFObservers and ReadOnlyEMFObservers.

EMFObservers may change the EMF model and therefore trigger further notifications. To prevent circular updates between EMFObservers, notifications that arrive while the handleNotification method is called, will not be forwarded to non ReadOnlyEMFObservers.

ReadOnlyEMFObservers are not allowed to change the EMF model. They will receive all notifications at any time.

Author:
Jonas, jfaltermeier

Method Summary
 void continueNotification()
          Notifying the EMFObservers is started again if stopNotification() was called beforehand.
 void continueNotification(Object blocker)
          Removes a blocker.
 void stopNotification()
          Stops notifying all EMFObservers.
 void stopNotification(Object blocker)
          Stops notifying all EMFObservers.
 void subscribe(EMFObserver observer)
          Adds an EMFObserver that will receive all notifications.
 void subscribeToEClass(EMFObserver observer, org.eclipse.emf.ecore.EClass eClass)
          Adds an EMFObserver that will receive notifications of notifiers with the given EClass.
 void subscribeToFeature(EMFObserver observer, org.eclipse.emf.ecore.EStructuralFeature feature)
          Adds an EMFObserver that will receive notifications when the given EStructuralFeautre is effected.
 void subscribeToTree(EMFObserver observer, org.eclipse.emf.ecore.EClass eClass)
          Adds an EMFObserver that will receive notifications of notifiers with the given EClass or which are contained (either direct or indirect) in an EObject of the given EClass.
 void unsubsribe(EMFObserver observer)
          Removes an observer.
 

Method Detail

subscribe

void subscribe(EMFObserver observer)
Adds an EMFObserver that will receive all notifications. Does nothing if already registered.

Parameters:
observer - the observer

subscribeToEClass

void subscribeToEClass(EMFObserver observer,
                       org.eclipse.emf.ecore.EClass eClass)
Adds an EMFObserver that will receive notifications of notifiers with the given EClass. Does nothing if already registered.

Parameters:
observer - the observer
eClass - the required EClass of the notifier

subscribeToTree

void subscribeToTree(EMFObserver observer,
                     org.eclipse.emf.ecore.EClass eClass)
Adds an EMFObserver that will receive notifications of notifiers with the given EClass or which are contained (either direct or indirect) in an EObject of the given EClass. Does nothing if already registered.

Parameters:
observer - the observer
eClass - the required EClass of the notifier or of one of its parents

subscribeToFeature

void subscribeToFeature(EMFObserver observer,
                        org.eclipse.emf.ecore.EStructuralFeature feature)
Adds an EMFObserver that will receive notifications when the given EStructuralFeautre is effected. Does nothing if already registered.

Parameters:
observer - the observer
feature - the feature to receive changes for

unsubsribe

void unsubsribe(EMFObserver observer)
Removes an observer. Does nothing if receiver is not registered.

Parameters:
observer - the receiver

stopNotification

void stopNotification()
Stops notifying all EMFObservers. ReadOnlyEMFObservers will still be notified.


continueNotification

void continueNotification()
Notifying the EMFObservers is started again if stopNotification() was called beforehand. Has no effect if the notification process has been blocked or if stopNotification() wasn't called before.


stopNotification

void stopNotification(Object blocker)
Stops notifying all EMFObservers. ReadOnlyEMFObservers will still be notified. The notifications will we blocked until continueNotification(Object) has been called with all blocking elements. Using the same blocker multiple times has no effect.

Parameters:
blocker - the key object used to block all notifications

continueNotification

void continueNotification(Object blocker)
Removes a blocker. When all blockers have been removed the notification process will continue. This method calls continueNotification() internally in all cases, even if the given blocker object was not used as a blocker beforehand.

Parameters:
blocker - the blocker object to remove.


Copyright © 2015. All Rights Reserved.