【问题标题】:EMF Refresh workspace after saving Resource [xText]保存资源后 EMF 刷新工作区 [xText]
【发布时间】:2013-11-05 09:00:29
【问题描述】:

我正在使用 EMF 将一个 eCore 模型转换为另一个 eCore 模型。一旦我构建了第二个 eCore 模型并使用以下代码将其保存到项目中,我必须手动刷新项目才能显示生成的模型。 EMF 开发中是否有任何方法可以刷新工作区/项目,从而不需要手动步骤?

Resource s5Resource = s5resourceSet.createResource(URI.createURI(s5ModelFileName));

// Convert to s5 model
s5Model = ConvertModelToS5Model.convert(model);

s5Resource.getContents().add(s5Model);

// Now save the content.
try {
    s5Resource.save(Collections.EMPTY_MAP);
} catch (IOException e) {
// TODO Auto-generated catch block
    e.printStackTrace();
}

【问题讨论】:

    标签: xtext eclipse-emf emf eclipse-emf-ecore ecore


    【解决方案1】:

    如果其他人有这个问题,我发现该方法在 IResource 接口中。该方法称为 refreshLocal()。

    API --> http://help.eclipse.org/helios/nftopic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/core/resources/IResource.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-15
      相关资源
      最近更新 更多