当前位置: 首页>>代码示例>>Java>>正文


Java XMIResourceImpl.save方法代码示例

本文整理汇总了Java中org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl.save方法的典型用法代码示例。如果您正苦于以下问题:Java XMIResourceImpl.save方法的具体用法?Java XMIResourceImpl.save怎么用?Java XMIResourceImpl.save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl的用法示例。


在下文中一共展示了XMIResourceImpl.save方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	IEditorPart editor = HandlerUtil.getActiveEditor(event);
	if ( editor instanceof AtlEditorExt ) {
		AtlEditorExt atlEditor = (AtlEditorExt) editor;
		IFile file = (IFile) atlEditor.getUnderlyingResource();
		
		AnalysisResult r = AnalysisIndex.getInstance().getAnalysis(file);

		for (MetamodelNamespace ns : r.getNamespace().getMetamodels()) {
			MetamodelPrunner prunner = new MetamodelPrunner(r.getATLModel(), ns);
			
			XMIResourceImpl res = new XMIResourceImpl();
			prunner.extractSource(res, ns.getName(), ns.getName() + "/prunned", ns.getName());
			try {
				res.save(new FileOutputStream(file.getLocation().removeLastSegments(1).append(ns.getName() + ".ecore").toOSString()), null);
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		
	}
	
	return null;
}
 
开发者ID:anatlyzer,项目名称:anatlyzer,代码行数:27,代码来源:SliceTransformationMetmodelsHandler.java

示例2: createGenModel

import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl; //导入方法依赖的package包/类
public static void createGenModel(final EPackage rootPackage, final IPath ecorePath, final IResource genmodelResource) {

		GenModel genModel = GenModelFactory.eINSTANCE.createGenModel();
		genModel.setComplianceLevel(GenJDKLevel.JDK60_LITERAL);
		genModel.setModelDirectory(ecorePath.removeLastSegments(1).toString());
		genModel.getForeignModel().add(ecorePath.lastSegment());
		genModel.setModelName(rootPackage.getName());
		genModel.setRootExtendsInterface("");
		genModel.initialize(Collections.singleton(rootPackage));

		GenPackage genPackage = (GenPackage) genModel.getGenPackages().get(0);
		genPackage.setPrefix("");

		try {
			URI genModelURI = URI.createURI(genmodelResource.getLocationURI().toString());
			final XMIResourceImpl genModelResource = new XMIResourceImpl(genModelURI);
			genModelResource.getContents().add(genModel);
			genModelResource.save(Collections.EMPTY_MAP);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
 
开发者ID:FTSRG,项目名称:mondo-collab-framework,代码行数:23,代码来源:MACLModelUtils.java

示例3: makeXml

import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl; //导入方法依赖的package包/类
private String makeXml ( final Component component ) throws IOException
{
    final XMIResourceImpl xmi = new XMIResourceImpl ();
    xmi.getContents ().add ( EcoreUtil.copy ( component ) );

    final StringWriter writer = new StringWriter ();
    xmi.save ( writer, null );
    return writer.toString ();
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:10,代码来源:ParserDriverProcessor.java

示例4: generateErrorSlice

import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl; //导入方法依赖的package包/类
protected void generateErrorSlice(String metamodelName,
		String errorSliceMMUri) throws IOException {
	XMIResourceImpl r = new XMIResourceImpl(URI.createURI(errorSliceMMUri));
	new ErrorSliceGenerator(analyser, analyser.getDependencyGraph())
			.generate(r);
	r.save(null);
}
 
开发者ID:anatlyzer,项目名称:anatlyzer,代码行数:8,代码来源:BaseTest.java

示例5: run

import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl; //导入方法依赖的package包/类
private void run() throws Exception {
	Resource atlTrafo = AtlLoader.load(TRANSFORMATION);
	AnalysisLoader loader = AnalysisLoader.fromResource(atlTrafo, new Object[] { UML_METAMODEL, JAVA_METAMODEL },  new String[] { "UML", "Java" });

	AnalysisResult result = loader.analyse();
			
	// Extract the footprint		
       XMIResourceImpl r =  new XMIResourceImpl(URI.createURI("examples/uml2java/metamodels/UML_footprint.ecore"));
       TrafoMetamodelData data = new TrafoMetamodelData(result.getATLModel(), result.getNamespace().getNamespace("UML"));
       new EffectiveMetamodelBuilder(data).extractSource(r, "uml_footprint", "http://uml_footprint", "uml_footprint", "UML Footprint");
       r.save(null);
}
 
开发者ID:anatlyzer,项目名称:anatlyzer,代码行数:13,代码来源:UML2Java_ExtractFootprint.java

示例6: writeGenModel

import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl; //导入方法依赖的package包/类
private void writeGenModel(GenModel genModel, final String genModelLocation) {
 try {
           org.eclipse.emf.common.util.URI genModelURI = URI.createFileURI(genModelLocation);
           final XMIResourceImpl genModelResource = new XMIResourceImpl(genModelURI);
           //genModelResource.getDefaultSaveOptions().put(XMLResource.OPTION_ENCODING, Constants.GEN_MODEL_XML_ENCODING.getValue());
           genModelResource.getContents().add(genModel);
           genModelResource.save(Collections.EMPTY_MAP);
       } catch (IOException e) {
       	MessageDialog.openError(shell, "Write Gen Model", e.getMessage());
       }

}
 
开发者ID:asupdev,项目名称:asup,代码行数:13,代码来源:GenModelGeneratorAction.java

示例7: readAndSave

import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl; //导入方法依赖的package包/类
public void readAndSave(String fileToBeParsed, String targetModelPath) throws Exception {
	EObject root = read(fileToBeParsed);
   	ResourceSetImpl rs = new ResourceSetImpl();
   	XMIResourceImpl xmi = (XMIResourceImpl) rs.createResource(URI.createFileURI(targetModelPath));    	

   	xmi.getContents().add(root);
   	xmi.save(null);    			
}
 
开发者ID:jesusc,项目名称:eclectic,代码行数:9,代码来源:ParseApiDesc.java

示例8: persistLinksModel

import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl; //导入方法依赖的package包/类
public static void persistLinksModel(WeavingModel linksModel,
                                     org.eclipse.emf.common.util.URI theUri) throws IOException {
  XMIResourceImpl linksModelResource = new XMIResourceImpl();
  linksModelResource.setURI(theUri);
  linksModelResource.getContents().add(linksModel);
  linksModelResource.save(null);

}
 
开发者ID:atlanmod,项目名称:emfviews,代码行数:9,代码来源:VirtualLinksUtil.java

示例9: persistLinksModel

import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl; //导入方法依赖的package包/类
public void persistLinksModel(org.eclipse.emf.common.util.URI linksModelURI) {
  XMIResourceImpl weavingModelResource = new XMIResourceImpl();

  weavingModelResource.setURI(linksModelURI);
  weavingModelResource.getContents().add(viewVirtualLinks);
  try {
    weavingModelResource.save(null);
  } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }
}
 
开发者ID:atlanmod,项目名称:emfviews,代码行数:13,代码来源:OclforEmfDelegate.java

示例10: createGenModel

import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl; //导入方法依赖的package包/类
public static GenPackage createGenModel(final EPackage rootPackage, final String ecoreLocation, String basePackage,
			Collection<GenPackage> usedGenPackages) throws IOException {
		GenModel genModel = GenModelFactory.eINSTANCE.createGenModel();
		genModel.setComplianceLevel(GenJDKLevel.JDK80_LITERAL);
		genModel.setCopyrightText(
				"Copyright (c) 2015-2017 Obeo, Inria\n" +
				"All rights reserved. This program and the accompanying materials\n" +
				"are made available under the terms of the Eclipse Public License v1.0\n" +
				"which accompanies this distribution, and is available at\n" +
				"http://www.eclipse.org/legal/epl-v10.html\n" +
				"	\n" +
				"Contributors:\n" +
				"- William Piers <[email protected]>\n" +
				"- Philippe Merle <[email protected]>\n"+
				"- Faiez Zalila <[email protected]>"
		);
		// Added to generate java code corresponding to OCL constraints defined in the OCCI extension
//		GenAnnotation genannotation = GenModelFactory.eINSTANCE.createGenAnnotation();
//		genannotation.setSource("http://www.eclipse.org/OCL/GenModel");
//		genannotation.getDetails().put("Use Delegates", "false");
//		genModel.getGenAnnotations().add(genannotation);
		
		String modelPluginId = new Path(ecoreLocation).removeLastSegments(2).lastSegment().toString();
		String editPluginId = modelPluginId + ".edit";
		String editorPluginId = modelPluginId + ".editor";
		String testsPluginId = modelPluginId + ".tests";
		genModel.setModelDirectory('/' + modelPluginId + "/src-gen");
		genModel.setEditDirectory('/' + editPluginId + "/src-gen");
		genModel.setEditorDirectory('/' + editorPluginId + "/src-gen");
		genModel.setTestsDirectory('/' + testsPluginId + "/src");
		genModel.getForeignModel().add(new Path(ecoreLocation).lastSegment());
		genModel.setModelName(ConverterUtils.toU1Case(rootPackage.getName()));
		genModel.setModelPluginID(modelPluginId);
		genModel.setEditPluginID(editPluginId);
		genModel.setEditorPluginID(editorPluginId);
		genModel.setTestsPluginID(testsPluginId);
		genModel.setRootExtendsInterface("org.eclipse.emf.ecore.EObject");
		// Activate code generation for Ecore reflective and dynamic invocation of OCCI actions.
		genModel.setOperationReflection(true);
		genModel.getUsedGenPackages().addAll(usedGenPackages);
		genModel.initialize(Collections.singleton(rootPackage));
		GenPackage genPackage = genModel.getGenPackages().get(0);
		genPackage.setPrefix(ConverterUtils.toU1Case(rootPackage.getNsPrefix()));
		genPackage.setBasePackage(basePackage);
		genPackage.setLoadInitialization(false);
		URI genModelURI = URI
				.createFileURI(new Path(ecoreLocation).removeFileExtension().addFileExtension("genmodel").toString());
		final XMIResourceImpl genModelResource = new XMIResourceImpl(genModelURI);
		genModelResource.getContents().add(genModel);
		genModelResource.save(Collections.EMPTY_MAP);
		return genPackage;
	}
 
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:53,代码来源:OCCI2EMFGeneratorUtils.java

示例11: generateEffectiveMetamodel

import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl; //导入方法依赖的package包/类
protected void generateEffectiveMetamodel(String logicalName, String outputPath) throws IOException {
    XMIResourceImpl r =  new XMIResourceImpl(URI.createURI(outputPath));
    TrafoMetamodelData data = new TrafoMetamodelData(atlTransformation, mm.getNamespace(logicalName));
    new EffectiveMetamodelBuilder(data).extractSource(r, logicalName, logicalName, logicalName, logicalName);
    r.save(null);
}
 
开发者ID:anatlyzer,项目名称:anatlyzer,代码行数:7,代码来源:BaseTest.java

示例12: saveConcept

import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl; //导入方法依赖的package包/类
public void saveConcept(String conceptFilename) throws IOException {
	XMIResourceImpl r =  new XMIResourceImpl(URI.createURI(conceptFilename));
	r.getContents().addAll(conceptPkg.getResource().getContents());
	r.save(null);
}
 
开发者ID:jesusc,项目名称:bento,代码行数:6,代码来源:BaseTest.java


注:本文中的org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl.save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。