如何在深度交叉引用时强制执行资源生成

时间:2014-04-29 12:06:09

标签: xtext

几个月前我刚开始使用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个文件:

file first.entities

entity entity1 {
  string s
}

file second.entities

entity entity2 extends entity1 {
  string s2
}

file third.entities

entity entity3 extends entity2 {
  string s3
}

当我修改entity1时,例如添加string myString,然后doGenerate(..)方法被调用两次 - first.entitiessecond.entities由于entity2entity1之间的交叉引用,但third.entity资源不会传递给doGenerate(..)

如何在整个依赖关系树中触发更改事件?

由于

0 个答案:

没有答案