public EObjectWrapper(T master, List<T> slaves)
{
this.slaves = slaves;
this.master = master;
this.master.eAdapters().add(new EContentAdapter()
{
@Override
public void notifyChanged(Notification notification)
{
super.notifyChanged(notification);
// Mind only 1-6 : SET, UNSET, ADD, REMOVE, ADD_ALL, REMOVE_ALL
if (notification.getEventType() > 6 || notification.getEventType()<1)
return;
for (EObject slave : EObjectWrapper.this.slaves)
{
if (notification.getNotifier() != EObjectWrapper.this.master)
{
if (((EObject)notification.getNotifier()).eContainer() == null) return;
String relativeURIFragmentPath = EcoreUtil.getRelativeURIFragmentPath(
EObjectWrapper.this.master,
(EObject) notification.getNotifier());
EObject subSlave = EcoreUtil.getEObject(slave, relativeURIFragmentPath);
pushToSlave(subSlave, notification);
}
else
{
pushToSlave(slave, notification);
}
}
}
});
}
EObjectWrapper.java 文件源码
java
阅读 17
收藏 0
点赞 0
评论 0
项目:Environment
作者:
评论列表
文章目录