Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Notify associated element
Notify associated element [message #987448] Mon, 26 November 2012 11:17 Go to previous message
Matthias N is currently offline Matthias N
Messages: 64
Registered: June 2012
Member
Hi,

I have the following scenario:

+-----------+                 +----------+
| Parent    |1               *| Children |
|           |-----------------|          |
+-----------+                 +----------+
A Parent is associated with several children (Note: NO containment reference)


What I want to do is the following:

When one of the parent's attributes changes, the children shall be notified.

I implemented handleNotificationEvent in parentEditPart:

@Override
 protected void handleNotificationEvent(Notification notification) {
  super.handleNotificationEvent(notification);
  //something has changed, notify my associated Children
  Parent parent = (Parent) this.resolveSemanticElement();
  for (Children c : parent.getChildren()) {
   c.eNotify(notification);
  }		
 }


And I am awaiting the Notification in ChildrenEditPart:
@Override
 protected void handleNotificationEvent(Notification notification) {
  super.handleNotificationEvent(notification);
  system.out.println("something has changed, update myself!!");	
 }



However it does not work, I get:
java.lang.StackOverflowError
	at org.eclipse.emf.transaction.impl.TransactionImpl.commit(TransactionImpl.java:474)
	at org.eclipse.gmf.runtime.diagram.core.DiagramEditingDomainFactory$DiagramEditingDomain.postcommit(DiagramEditingDomainFactory.java:220)
	at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.deactivate(TransactionalEditingDomainImpl.java:543)
	at org.eclipse.emf.transaction.impl.TransactionImpl.close(TransactionImpl.java:712)
	at org.eclipse.emf.transaction.impl.TransactionImpl.commit(TransactionImpl.java:474)
	at org.eclipse.gmf.runtime.diagram.core.DiagramEditingDomainFactory$DiagramEditingDomain.postcommit(DiagramEditingDomainFactory.java:220)
	at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.deactivate(TransactionalEditingDomainImpl.java:543)
	at org.eclipse.emf.transaction.impl.TransactionImpl.close(TransactionImpl.java:712)
	at org.eclipse.emf.transaction.impl.TransactionImpl.commit(TransactionImpl.java:474)
	at org.eclipse.gmf.runtime.diagram.core.DiagramEditingDomainFactory$DiagramEditingDomain.postcommit(DiagramEditingDomainFactory.java:220)
	at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.deactivate(TransactionalEditingDomainImpl.java:543)
	at org.eclipse.emf.transaction.impl.TransactionImpl.close(TransactionImpl.java:712)
	at org.eclipse.emf.transaction.impl.TransactionImpl.commit(TransactionImpl.java:474)
...

 
Read Message
Read Message
Previous Topic:get business object from editpart
Next Topic:Generator overwriting extension point definitions
Goto Forum:
  


Current Time: Sat May 25 16:23:58 EDT 2013

Powered by FUDForum. Page generated in 0.01746 seconds