WorkspaceUtil.java 文件源码

java
阅读 18 收藏 0 点赞 0 评论 0

项目:termsuite-ui 作者:
public static void saveResource(EObject emfObject, Path path) {
        // Obtain a new resource set
        ResourceSet resSet = new ResourceSetImpl();
        Resource resource = resSet
                .createResource(URI.createFileURI(path.toString()));
        // Get the first model element and cast it to the right type, in my
        // example everything is hierarchical included in this first node

//      if (emfObject instanceof EPipeline) {
//          resource.getContents().add(((EPipeline) emfObject).getTaggerConfig());
//      }
        resource.getContents().add(emfObject);

        // now save the content.
        Map<String, Object> options = Maps.newHashMap();
//      options.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, false);
        try {
            resource.save(options);
        } catch (IOException e) {
            throw new TermSuiteException("Could not save resource " + emfObject.getClass().getSimpleName(), e);
        }
    }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号