Runtime

org.eclipse.gmf.runtime.diagram.core.listener
Class DiagramEventBroker

java.lang.Object
  extended byorg.eclipse.emf.transaction.ResourceSetListenerImpl
      extended byorg.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker
All Implemented Interfaces:
java.util.EventListener, org.eclipse.emf.transaction.ResourceSetListener

public class DiagramEventBroker
extends org.eclipse.emf.transaction.ResourceSetListenerImpl

A model server listener that broadcast EObject events to all registered listeners.


Nested Class Summary
static interface DiagramEventBroker.DiagramEventBrokerFactory
          Factory interface that can be used to create overrides of the DiagramEventBroker class
 
Constructor Summary
protected DiagramEventBroker()
          Creates a DiagramEventBroker that listens to all EObject notifications for the given editing domain.
 
Method Summary
 void addNotificationListener(EObject target, EStructuralFeature key, NotificationListener listener)
          Add the supplied listener to the listener list.
 void addNotificationListener(EObject target, EStructuralFeature key, NotificationPreCommitListener listener)
          Add the supplied listener to the listener list.
 void addNotificationListener(EObject target, NotificationListener listener)
          Add the supplied listener to the listener list.
 void addNotificationListener(EObject target, NotificationPreCommitListener listener)
          Add the supplied listener to the listener list.
static DiagramEventBroker getInstance(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain)
          Gets the diagmam event broker instance for the editing domain passed in.
protected  java.util.Set getInterestedNotificationListeners(Notification event, org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker.NotifierToKeyToListenersSetMap listeners)
          gets a subset of all the registered listeners who are interested in receiving the supplied event.
 boolean isAggregatePrecommitListener()
           
static void registerDiagramEventBrokerFactory(DiagramEventBroker.DiagramEventBrokerFactory newDebFactory)
           
 void removeNotificationListener(EObject target, NotificationListener listener)
          remove the supplied listener from the listener list.
 void removeNotificationListener(EObject target, NotificationPreCommitListener listener)
          remove the supplied listener from the listener list.
 void removeNotificationListener(EObject target, java.lang.Object key, NotificationListener listener)
          remove the supplied listener from the listener list.
 void removeNotificationListener(EObject target, java.lang.Object key, NotificationPreCommitListener listener)
          remove the supplied listener from the listener list.
 void resourceSetChanged(org.eclipse.emf.transaction.ResourceSetChangeEvent event)
           
protected  boolean shouldIgnoreNotification(Notification notification)
          determine if the passed notification can be ignored or not the default implementation will ignore touch event if it is not a resolve event, also it will ignore the mutable feature events
static void startListening(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain)
          Creates a new diagram event broker instance for the editing domain passed in only if the editing domain does not already have a diagram event broker.
static void stopListening(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain)
           
 Command transactionAboutToCommit(org.eclipse.emf.transaction.ResourceSetChangeEvent event)
           
 
Methods inherited from class org.eclipse.emf.transaction.ResourceSetListenerImpl
getFilter, isPostcommitOnly, isPrecommitOnly
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DiagramEventBroker

protected DiagramEventBroker()
Creates a DiagramEventBroker that listens to all EObject notifications for the given editing domain.

Method Detail

getInstance

public static DiagramEventBroker getInstance(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain)
Gets the diagmam event broker instance for the editing domain passed in. There is one diagram event broker per editing domain.

Parameters:
editingDomain -
Returns:
Returns the diagram event broker.

startListening

public static void startListening(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain)
Creates a new diagram event broker instance for the editing domain passed in only if the editing domain does not already have a diagram event broker. There is one diagram event broker per editing domain. Adds the diagram event broker instance as a listener to the editing domain.

Parameters:
editingDomain -

registerDiagramEventBrokerFactory

public static void registerDiagramEventBrokerFactory(DiagramEventBroker.DiagramEventBrokerFactory newDebFactory)
Parameters:
newDebFactory -

stopListening

public static void stopListening(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain)
Parameters:
editingDomain -

transactionAboutToCommit

public Command transactionAboutToCommit(org.eclipse.emf.transaction.ResourceSetChangeEvent event)

resourceSetChanged

public void resourceSetChanged(org.eclipse.emf.transaction.ResourceSetChangeEvent event)

shouldIgnoreNotification

protected boolean shouldIgnoreNotification(Notification notification)
determine if the passed notification can be ignored or not the default implementation will ignore touch event if it is not a resolve event, also it will ignore the mutable feature events

Parameters:
notification - the notification to check
Returns:
true if the notification should be ignored, otherwise false

addNotificationListener

public final void addNotificationListener(EObject target,
                                          NotificationPreCommitListener listener)
Add the supplied listener to the listener list.

Parameters:
target - the traget to listen to
listener - the listener

addNotificationListener

public final void addNotificationListener(EObject target,
                                          NotificationListener listener)
Add the supplied listener to the listener list.

Parameters:
target - the traget to listen to
listener - the listener

addNotificationListener

public final void addNotificationListener(EObject target,
                                          EStructuralFeature key,
                                          NotificationPreCommitListener listener)
Add the supplied listener to the listener list.

Parameters:
target - the traget to listen to
key - the key for the listener
listener - the listener

addNotificationListener

public final void addNotificationListener(EObject target,
                                          EStructuralFeature key,
                                          NotificationListener listener)
Add the supplied listener to the listener list.

Parameters:
target - the traget to listen to
key - the key for the listener
listener - the listener

removeNotificationListener

public final void removeNotificationListener(EObject target,
                                             NotificationPreCommitListener listener)
remove the supplied listener from the listener list.

Parameters:
target - the traget to listen to
listener - the listener

removeNotificationListener

public final void removeNotificationListener(EObject target,
                                             NotificationListener listener)
remove the supplied listener from the listener list.

Parameters:
target - the traget to listen to
listener - the listener

removeNotificationListener

public final void removeNotificationListener(EObject target,
                                             java.lang.Object key,
                                             NotificationPreCommitListener listener)
remove the supplied listener from the listener list.

Parameters:
target - the traget to listen to
key - the key for the listener
listener - the listener

removeNotificationListener

public final void removeNotificationListener(EObject target,
                                             java.lang.Object key,
                                             NotificationListener listener)
remove the supplied listener from the listener list.

Parameters:
target - the traget to listen to
key - the key for the listener
listener - the listener

getInterestedNotificationListeners

protected final java.util.Set getInterestedNotificationListeners(Notification event,
                                                                 org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker.NotifierToKeyToListenersSetMap listeners)
gets a subset of all the registered listeners who are interested in receiving the supplied event.

Parameters:
event - the event to use
Returns:
the interested listeners in the event

isAggregatePrecommitListener

public boolean isAggregatePrecommitListener()

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.