本文整理汇总了Java中org.eclipse.m2m.atl.engine.parser.AtlParser.inject方法的典型用法代码示例。如果您正苦于以下问题:Java AtlParser.inject方法的具体用法?Java AtlParser.inject怎么用?Java AtlParser.inject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.m2m.atl.engine.parser.AtlParser
的用法示例。
在下文中一共展示了AtlParser.inject方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadTransformationModel
import org.eclipse.m2m.atl.engine.parser.AtlParser; //导入方法依赖的package包/类
/**
* It loads a transformation as a model.
* @param atlTransformationFile
* @return transformation model
* @throws ATLCoreException
*/
private EMFModel loadTransformationModel (String atlTransformationFile) throws ATLCoreException {
ModelFactory modelFactory = new EMFModelFactory();
EMFReferenceModel atlMetamodel = (EMFReferenceModel)modelFactory.getBuiltInResource("ATL.ecore");
AtlParser atlParser = new AtlParser();
EMFModel atlModel = (EMFModel)modelFactory.newModel(atlMetamodel);
atlParser.inject (atlModel, atlTransformationFile);
atlModel.setIsTarget(true);
// // Should we want to serialize the model.
// String injectedFile = "file:/" + atlTransformationFile + ".xmi";
// IExtractor extractor = new EMFExtractor();
// extractor.extract(atlModel, injectedFile);
return atlModel;
}
示例2: typing
import org.eclipse.m2m.atl.engine.parser.AtlParser; //导入方法依赖的package包/类
public void typing(String atlTransformationFile, Object[] metamodels, String[] names) throws Exception {
this.atlTransformationFile = atlTransformationFile;
long diffs = 0;
AtlParser atlParser = new AtlParser();
ModelFactory modelFactory = new EMFModelFactory();
IReferenceModel atlMetamodel = modelFactory
.getBuiltInResource("ATL.ecore");
EMFModel atlModel = (EMFModel) modelFactory.newModel(atlMetamodel);
atlParser.inject(atlModel, atlTransformationFile);
this.mm = loadMetamodels(metamodels, names);
this.atlTransformation = new ATLModel(atlModel.getResource(), atlTransformationFile);
this.analyser = new Analyser(mm, atlTransformation);
long initTime = System.currentTimeMillis();
analyser.perform();
analysisData = new AnalysisResult(analyser);
long finishTime = System.currentTimeMillis();
diffs += (finishTime - initTime);
// }
System.out.println("Time: " + (diffs / 1000.0));
}
示例3: loadAtlTransformation
import org.eclipse.m2m.atl.engine.parser.AtlParser; //导入方法依赖的package包/类
private Resource loadAtlTransformation() {
ModelFactory modelFactory = new EMFModelFactory();
IReferenceModel atlMetamodel;
try {
atlMetamodel = modelFactory.getBuiltInResource("ATL.ecore");
EMFModel loadedAtlModel = (EMFModel) modelFactory
.newModel(atlMetamodel);
AtlParser atlParser = new AtlParser();
String srcFile = original.getTemplate();
String anURI = filePathResolver.resolveTransformation(component, srcFile);
atlParser.inject(loadedAtlModel, anURI);
//filePathResolver.resolve(srcFile));
loadedAtlModel.setIsTarget(true);
return loadedAtlModel.getResource();
} catch ( ATLCoreException e ) {
throw new RuntimeException(e);
}
}
示例4: load
import org.eclipse.m2m.atl.engine.parser.AtlParser; //导入方法依赖的package包/类
public static Resource load(String fname) throws ATLCoreException {
AtlParser atlParser = new AtlParser();
ModelFactory modelFactory = new EMFModelFactory();
IReferenceModel atlMetamodel = modelFactory.getBuiltInResource("ATL.ecore");
EMFModel atlDynModel = (EMFModel) modelFactory.newModel(atlMetamodel);
atlParser.inject(atlDynModel, fname);
Resource originalTrafo = atlDynModel.getResource();
return originalTrafo;
}
示例5: run
import org.eclipse.m2m.atl.engine.parser.AtlParser; //导入方法依赖的package包/类
/**
* @see IActionDelegate#run(IAction)
*/
public void run(IAction action) {
IFile f = (IFile) ((IStructuredSelection) selection).getFirstElement();
//ResourceSet rs = new ResourceSetImpl();
//Resource r = rs.getResource(URI.createPlatformResourceURI(f.getFullPath().toPortableString(), true), true);
ModelFactory modelFactory = new EMFModelFactory();
IReferenceModel atlMetamodel;
try {
atlMetamodel = modelFactory.getBuiltInResource("ATL.ecore");
IModel atlModel = modelFactory.newModel(atlMetamodel);
AtlParser atlParser = new AtlParser();
String srcFile = f.getLocation().toPortableString();
atlParser.inject(atlModel, srcFile);
atlModel.setIsTarget(true);
String injectedFile = "file:/" + srcFile + ".xmi";
IExtractor extractor = new EMFExtractor();
extractor.extract(atlModel, injectedFile);
} catch (ATLCoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} //$NON-NLS-1$
}