public class ChangeBrokerImpl extends Object implements ChangeBroker, NotificationReceiver
ChangeBroker
.
Registers itself as a NotificationReceiver
at all providers
. Once it
gets notified it forwards the notification to all of the brokers notification receivers, as applicable.Constructor and Description |
---|
ChangeBrokerImpl()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addNotificationProvider(NotificationProvider provider)
Adds a notification provider.
|
boolean |
canDelete(org.eclipse.emf.ecore.EObject toBeDeleted) |
void |
continueNotification()
Notifying the
ChangeObserver is started again if ChangeBroker.stopNotification() was called
beforehand. |
void |
continueNotification(Object blocker)
Removes a
blocker . |
Set<NotificationProvider> |
getNotificationProviders()
For testing purposes.
|
Set<ChangeObserver> |
getRegisteredObservers()
For testing purposes.
|
void |
notify(org.eclipse.emf.common.notify.Notification notification)
Called whenever there is a new
Notification meant for the receiver. |
void |
notifyPostDelete(org.eclipse.emf.ecore.EObject toBeDeleted)
Called after an element was deleted.
|
void |
notifyPreDelete(org.eclipse.emf.ecore.EObject toBeDeleted)
Called before an element gets deleted, after all
VetoableDeleteObserver have returned true and therefore
the delete operation is allowed. |
void |
removeNotificationProvider(NotificationProvider provider)
Removes a notification provider.
|
void |
stopNotification()
Stops notifying all
ChangeObserver . |
void |
stopNotification(Object blocker)
Stops notifying all
ChangeObserver . |
void |
subscribe(EMFObserver observer)
Adds an
ChangeObserver that will receive all notifications. |
void |
subscribeToEClass(ChangeObserver observer,
org.eclipse.emf.ecore.EClass eClass)
Adds an
ChangeObserver that will receive notifications of notifiers with the given EClass. |
void |
subscribeToFeature(ChangeObserver observer,
org.eclipse.emf.ecore.EStructuralFeature feature)
Adds an
ChangeObserver that will receive notifications when the given EStructuralFeautre is effected. |
void |
subscribeToTree(ChangeObserver observer,
org.eclipse.emf.ecore.EClass eClass)
Adds an
ChangeObserver 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 receiver)
Removes an observer.
|
public void addNotificationProvider(NotificationProvider provider)
provider
- the providerpublic void removeNotificationProvider(NotificationProvider provider)
provider
- the providerpublic void notify(org.eclipse.emf.common.notify.Notification notification)
Notification
meant for the receiver.notify
in interface NotificationReceiver
notification
- the notificationChangeObserver.handleNotification(org.eclipse.emf.common.notify.Notification)
public void subscribe(EMFObserver observer)
ChangeObserver
that will receive all notifications. Does nothing if already registered.subscribe
in interface ChangeBroker
observer
- the observerChangeBroker.subscribe(org.eclipse.emf.ecp.changebroker.spi.EMFObserver)
public void subscribeToEClass(ChangeObserver observer, org.eclipse.emf.ecore.EClass eClass)
ChangeObserver
that will receive notifications of notifiers with the given EClass. Does nothing
if
already registered.subscribeToEClass
in interface ChangeBroker
observer
- the observereClass
- the required EClass of the notifierChangeBroker.subscribeToEClass(org.eclipse.emf.ecp.changebroker.spi.ChangeObserver,
org.eclipse.emf.ecore.EClass)
public void subscribeToTree(ChangeObserver observer, org.eclipse.emf.ecore.EClass eClass)
ChangeObserver
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.subscribeToTree
in interface ChangeBroker
observer
- the observereClass
- the required EClass of the notifier or of one of its parentsChangeBroker.subscribeToTree(org.eclipse.emf.ecp.changebroker.spi.ChangeObserver,
org.eclipse.emf.ecore.EClass)
public void subscribeToFeature(ChangeObserver observer, org.eclipse.emf.ecore.EStructuralFeature feature)
ChangeObserver
that will receive notifications when the given EStructuralFeautre is effected.
Does
nothing if
already registered.subscribeToFeature
in interface ChangeBroker
observer
- the observerfeature
- the feature to receive changes forChangeBroker.subscribeToFeature(org.eclipse.emf.ecp.changebroker.spi.ChangeObserver,
org.eclipse.emf.ecore.EStructuralFeature)
public void unsubsribe(EMFObserver receiver)
unsubsribe
in interface ChangeBroker
receiver
- the receiverChangeBroker.unsubsribe(org.eclipse.emf.ecp.changebroker.spi.EMFObserver)
public void stopNotification()
ChangeObserver
. ReadOnlyEMFObservers
will
still
be notified.stopNotification
in interface ChangeBroker
ChangeBroker.stopNotification()
public void continueNotification()
ChangeObserver
is started again if ChangeBroker.stopNotification()
was called
beforehand. Has no effect if the notification process has been blocked
or if
ChangeBroker.stopNotification()
wasn't called before.continueNotification
in interface ChangeBroker
ChangeBroker.continueNotification()
public Set<NotificationProvider> getNotificationProviders()
public Set<ChangeObserver> getRegisteredObservers()
public void stopNotification(Object blocker)
ChangeObserver
. ReadOnlyEMFObservers
will
still
be notified. The notifications will we blocked until ChangeBroker.continueNotification(Object)
has been called with
all blocking elements. Using the same blocker multiple times has no effect.stopNotification
in interface ChangeBroker
blocker
- the key object used to block all notificationsChangeBroker.stopNotification(java.lang.Object)
public void continueNotification(Object blocker)
blocker
. When all blockers have been removed the
notification process will continue. This method calls ChangeBroker.continueNotification()
internally in all cases,
even if the given blocker object was not used as a blocker beforehand.continueNotification
in interface ChangeBroker
blocker
- the blocker object to remove.ChangeBroker.continueNotification(java.lang.Object)
public void notifyPreDelete(org.eclipse.emf.ecore.EObject toBeDeleted)
NotificationReceiver
VetoableDeleteObserver
have returned true and therefore
the delete operation is allowed.notifyPreDelete
in interface NotificationReceiver
toBeDeleted
- The EObject
to be deletedpublic void notifyPostDelete(org.eclipse.emf.ecore.EObject toBeDeleted)
NotificationReceiver
notifyPostDelete
in interface NotificationReceiver
toBeDeleted
- The deleted EObject
public boolean canDelete(org.eclipse.emf.ecore.EObject toBeDeleted)
canDelete
in interface NotificationReceiver
toBeDeleted
- The EObject
to be deletedVetoableDeleteObserver
has returned falseCopyright © 2019. All rights reserved.