Eclipse 获取有关列表更改的通知
我正在基于创建一个自定义Ecore编辑器,并发现列表中的更改不会在模型更改通知中显示。例如,对Eclipse 获取有关列表更改的通知,eclipse,emf,ecore,Eclipse,Emf,Ecore,我正在基于创建一个自定义Ecore编辑器,并发现列表中的更改不会在模型更改通知中显示。例如,对EAnnotation.references列表的更改不会导致模型更改通知,而EAnnotation.setSource()方法会创建通知。我想,这就是为什么EAnnotationItemProvider中的默认getText()方法只使用source字段的原因之一 我正在使用references字段的值来生成EAnnotation的UI表示,因此查看此字段的更改对于正确操作是必要的 是否有一些标准方法
EAnnotation.references
列表的更改不会导致模型更改通知,而EAnnotation.setSource()
方法会创建通知。我想,这就是为什么EAnnotationItemProvider
中的默认getText()
方法只使用source
字段的原因之一
我正在使用references
字段的值来生成EAnnotation
的UI表示,因此查看此字段的更改对于正确操作是必要的
是否有一些标准方法可以观察这些更改并在模型视图上触发一个
refresh()
?我发现通知是创建的,但notifyChanged()
方法最初忽略了它。这就是我的工作原理:
@Override
public void notifyChanged(Notification notification) {
updateChildren(notification);
switch (notification.getFeatureID(EAnnotation.class)) {
case EcorePackage.EANNOTATION__SOURCE:
case EcorePackage.EANNOTATION__REFERENCES: /*ADDED*/
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
return;
case EcorePackage.EANNOTATION__CONTENTS:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
return;
case EcorePackage.EANNOTATION__DETAILS: /*MODIFIED TO UPDATE VIEW*/
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, true));
return;
}
super.notifyChanged(notification);
}