EContentAdapter not fired for containment relation [message #991769] |
Thu, 20 December 2012 01:46  |
Eclipse User |
|
|
|
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 ?
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.06156 seconds