几个月前我刚开始使用Xtext
。
我有以下语法:
grammar org.example.entities.Entities with org.eclipse.xtext.common.Terminals
generate entities "http://www.example.org/entities/Entities"
import "http://www.eclipse.org/emf/2002/Ecore" as ecore
import "http: //www. eclipse.org/xtext/common/JavaVMTypes"
Model: entities += Entity | Composite;
Entity:
'entity' name = ID ('extends' superType=[Entity])? '{'
attributes += Attribute*
strings += StringAttr*
'}'
;
StringAttr: 'string' name=ID;
Attribute:
type=[Entity] array?=('[]')? name=ID ';';
EntityField:
'field' field=[Entity];
假设我有3个文件:
first.entities
:entity entity1 {
string s
}
second.entities
:entity entity2 extends entity1 {
string s2
}
third.entities
:entity entity3 extends entity2 {
string s3
}
当我修改entity1
时,例如添加string myString
,然后doGenerate(..)
方法被调用两次 - first.entities
和second.entities
由于entity2
和entity1
之间的交叉引用,但third.entity
资源不会传递给doGenerate(..)
。
如何在整个依赖关系树中触发更改事件?
由于