/*
   * (non-Javadoc)
   * @see com.bluexml.side.util.generator.acceleo.AbstractAcceleoGenerator#
   * overHeadingModels(java.util.List)
   */
  @Override
  protected IFile overHeadingModels(List<IFile> models) throws Exception {
    File temporarySystemFile = this.getTemporarySystemFile();
    if (!temporarySystemFile.exists()) {
      temporarySystemFile.mkdirs();
    }
    IFolder iFile = IFileHelper.getIFolder(temporarySystemFile);
    IPath fullPath = iFile.getFullPath();
    // create overhead model resource
    // IPath p = models.get(0).getParent().getFullPath();

    IPath p = fullPath;
    p = p.append(OVER_HEAD_MODEL + "." + models.get(0).getFileExtension());
    IFile overheadedModel = IFileHelper.getIFile(p);

    // create overhead root element
    Model m = ClazzFactory.eINSTANCE.createModel();
    m.setName(OVER_HEAD_MODEL);
    MetaInfo createMetaInfo = CommonFactory.eINSTANCE.createMetaInfo();
    createMetaInfo.setKey("overHead");
    m.getMetainfo().add(createMetaInfo);
    for (IFile model : models) {
      EList<EObject> openModel = EResourceUtils.openModel(model);
      Model eObject = (Model) openModel.get(0);
      m.getPackageSet().add(eObject);
    }
    // save overhead model
    EResourceUtils.saveModel(overheadedModel, m);
    return overheadedModel;
  }
Esempio n. 2
0
 protected static EObject openModel(IFile classModel) throws IOException {
   EList<EObject> l = EResourceUtils.openModel(classModel);
   return l.get(0);
 }