我正在使用我自己的资源,它不是 XMI 资源类型。如果我在 Sirius 图表编辑器中创建 Eobject,它会在 Xtext 编辑器中反映,但反之亦然不工作。如果我尝试在 Xtext 编辑器中编辑任何元素的短名称 Sirius 图表是丢失的。我觉得我的图表丢失了,因为 Resource 无法根据 URI 片段获取更新的元素。Plaese 帮助我如何获取更新的元素 URI 片段,这样图表就不会丢失。
1 回答
When you save your Xtext editor, it triggers a reload of the resource by Sirius (they do not share the same editing domain or resourceSet).
During the load, your resource creates a new model in memory. The elements previously known by Sirius cannot be retrieved: you modified an attribute which impact the URI fragment. The Sirius graphical elements reference the old elements.
If you launch a refresh (from the tool bar of the diagram), it might retrieve some content but the layout will be lost as the (re)loaded model is a new set of objects.
You mid find some hints in the following resources:
- White Paper on Sirius and Xtext
- Talk Integrating Xtext and Sirius: Strategies and Pitfalls: video, slides
- Blog post presenting several ways to from the Sirius editors or the properties