Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EContentAdapter not fired for containment relation
EContentAdapter not fired for containment relation [message #991769] Thu, 20 December 2012 01:46 Go to previous message
Deepak P is currently offline Deepak P
Messages: 15
Registered: January 2012
Junior Member
Hello All,
I am very much new to EMF concepts. So i have a doubt regarding adding an EContentAdapter.

We have "MySystem" object in the Ecore. And "MySystem" has a containment relationship to "MyElements". So when i add a EContentAdapter to "MySystem", If there are any changes in "MyElements" , the notifier should be notified right ?

The code snippet is as given below

public class MySystemCreator {

private void create() {
mySystem = myFactory.createMySystem();
MySystemChangeContentAdapter mySystemChangeContentAdapter = new MySystemChangeContentAdapter();
mySystem.eAdapters().add(mySystemChangeContentAdapter );
}
}

public class MySystemChangeContentAdapter extends EContentAdapter {

@Override
public void notifyChanged(final Notification notification) {
super.notifyChanged(notification);
System.out.println("Executed");
}
}

public class CreateMyElements {

public Object[] create(){

...
mySystem.getElements().add(myElement);
}
}

So when we add "myElement" to "mySystem", the notifier is not fired.

Is it the correct way of writing a EcontentAdapter ?


 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic:Locking Mechanism in CDO
Next Topic:[XCore] Generating artifacts
Goto Forum:
  


Current Time: Sat May 25 22:49:03 EDT 2013

Powered by FUDForum. Page generated in 0.01567 seconds