简体   繁体   English

如何将EMF模型保存到文件夹和文件的层次结构中

[英]How to save an EMF model to a hierarchy of folders and files

I am implementing a commercial RCP application where the user can create projects for example of this format: 我正在实现一个商业RCP应用程序,用户可以创建项目,例如这种格式:

  • Project1 PROJECT1
    • SubElement1 SubElement1
    • SubElement2 SubElement2
      • SubSubElement1 SubSubElement1
  • Project2 项目2
  • .... ....

etc. 等等

I am using EMF to model the data domain and I want to save the data.I want to have a hierarchy of folders and files for each project eg Folder 1 should be Project1 containing a Folder SubElement1 which contains some xml files. 我正在使用EMF来建模数据域,我想保存数据。我希望每个项目都有一个文件夹和文件的层次结构,例如,文件夹1应该是包含文件夹SubElement1的Project1,其中包含一些xml文件。 etc. 等等

I found examples to save EMF models but I didn't figure out how to save this folder-files hierarchy under one EMF resource... 我找到了保存EMF模型的示例,但我没有弄清楚如何在一个EMF资源下保存这个文件夹文件层次结构......

There is no way spreading a single resource across multiple files. 没有办法在多个文件之间传播单个资源。 In spite of that, EMF provides you a mechanism for working with parts/multiple instance of a model through ResourceSet. 尽管如此,EMF为您提供了一种通过ResourceSet处理模型的部件/多个实例的机制。 What's more, you can even have a cross-references between multiple models in multiple files. 更重要的是,您甚至可以在多个文件中的多个模型之间进行交叉引用。

Another advice for you, is using Eclipse Resource API for managing creation of folder and files in workspace, and let EMF deal with all the model stuff. 另一个建议是使用Eclipse Resource API来管理工作区中文件夹和文件的创建,让EMF处理所有模型。 That's how we are doing it in our project. 这就是我们在项目中的表现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM