import org.eclipse.epsilon.emc.emf.EmfModel; import org.eclipse.epsilon.emc.emf.EmfUtil; import org.eclipse.epsilon.emc.emf.EpsilonResourceSet; EpsilonResourceSet resourceSet = new EpsilonResourceSet(); EmfUtil.register(URI.createURI("path/to/metamodel.ecore"), EPackage.Registry.INSTANCE); EmfModel model = new EmfModel(); model.setMetamodelFile("path/to/metamodel.ecore"); model.setModelFile("path/to/model.xmi"); model.setName("MyModel"); model.setReadOnLoad(true); model.setStoredOnDisposal(false); model.setCachingEnabled(true); model.setExpand(true); model.setReuseUnmodifiedMetamodels(true); model.load(); Object rootElement = model.getModelImpl().getResource().getContents().get(0); model.store(); import org.eclipse.epsilon.emc.emf.EmfModel; import org.eclipse.epsilon.eol.EolModule; EolModule module = new EolModule(); module.getContext().getModelRepository().addModel(model); module.execute(); List<Object> result = (List<Object>) module.getContext().getFrameStack().get(0).get(0); for (Object element : result) { } import org.eclipse.epsilon.eol.models.IModel; import org.eclipse.epsilon.eol.models.ModelFactory; IModel inputModel = ModelFactory.getInstance().createModel("EMF"); inputModel.load("path/to/inputModel.xmi"); IModel outputModel = ModelFactory.getInstance().createModel("EMF"); outputModel.create(); outputModel.setName("OutputModel"); EtlModule module = new EtlModule(); module.getContext().getModelRepository().addModel(inputModel); module.getContext().getModelRepository().addModel(outputModel); module.execute(); import org.eclipse.epsilon.eol.models.IModel; import org.eclipse.epsilon.eol.models.ModelFactory; IModel model = ModelFactory.getInstance().createModel("EMF"); model.load("path/to/model.xmi"); String template = "path/to/template.egl"; EglFileGeneratingTemplateFactory templateFactory = new EglFileGeneratingTemplateFactory(); EGxModule module = new EGxModule(templateFactory); module.parse(template); module.getContext().getModelRepository().addModel(model); module.execute();


上一篇:
下一篇:
切换中文