• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java GenJDKLevel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.emf.codegen.ecore.genmodel.GenJDKLevel的典型用法代码示例。如果您正苦于以下问题:Java GenJDKLevel类的具体用法?Java GenJDKLevel怎么用?Java GenJDKLevel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



GenJDKLevel类属于org.eclipse.emf.codegen.ecore.genmodel包,在下文中一共展示了GenJDKLevel类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createGenModel

import org.eclipse.emf.codegen.ecore.genmodel.GenJDKLevel; //导入依赖的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


示例2: generate

import org.eclipse.emf.codegen.ecore.genmodel.GenJDKLevel; //导入依赖的package包/类
public VirtualFile generate(VirtualFile basedir) throws DatabaseException {
		GenModel genModel = GenModelFactory.eINSTANCE.createGenModel();
		genModel.setRuntimeVersion(GenRuntimeVersion.EMF25);
		genModel.setComplianceLevel(GenJDKLevel.JDK60_LITERAL);
		genModel.setFeatureDelegation(GenDelegationKind.REFLECTIVE_LITERAL);
		genModel.setRootExtendsClass("org.bimserver.emf.IdEObjectImpl");
		genModel.setRootExtendsInterface("org.bimserver.emf.IdEObject");
		genModel.setSuppressContainment(true);
		genModel.setCodeFormatting(true);
		genModel.setCopyrightText(StringUtils.readFromFile(new File("copyright.txt")));
		genModel.setCanGenerate(true);
		genModel.setModelDirectory("test");
		genModel.setModelName("model name");
		genModel.setForceOverwrite(true);
		genModel.setSuppressNotification(false);
		genModel.setContainmentProxies(false);
		genModel.setBinaryCompatibleReflectiveMethods(false);
		genModel.setPublicConstructors(false);
		genModel.setMinimalReflectiveMethods(true); // More code, but faster
		genModel.setUpdateClasspath(false);

		genModel.initialize(schema.getEPackages());
		
		GeneratorAdapterFactory.Descriptor.Registry.INSTANCE.addDescriptor(GenModelPackage.eNS_URI, GenModelGeneratorAdapterFactory.DESCRIPTOR);
		Generator generator = new Generator();
		generator.setInput(genModel);
		generator.generate(genModel, GenBaseGeneratorAdapter.MODEL_PROJECT_TYPE, new BasicMonitor.Printing(System.out));

		
//		List<GenPackage> genPackages = createGenPackages(genModel, basedir);
//		generatePackages(genModel, genPackages, basedir);

		return basedir;
	}
 
开发者ID:opensourceBIM,项目名称:BIMserver,代码行数:35,代码来源:DataObjectGenerator.java


示例3: createGenModel

import org.eclipse.emf.codegen.ecore.genmodel.GenJDKLevel; //导入依赖的package包/类
private GenModel createGenModel(Resource resource, IPath ecoreLocation, String genModelName) {

// Get root package
EPackage rootPackage = (EPackage)resource.getContents().get(0);
	
// Create genModel and initialize with referred ecore model
      GenModel genModel = GenModelFactory.eINSTANCE.createGenModel();
      genModel.getForeignModel().add(ecoreLocation.lastSegment());       
      genModel.initialize(Collections.singleton(rootPackage));

      // Set properties for GenModel	                
      genModel.setComplianceLevel(GenJDKLevel.JDK70_LITERAL);
      genModel.setCopyrightText("");
      genModel.setLanguage("EN");
      genModel.setModelName(genModelName + " genmodel");
      genModel.setModelDirectory(project.getName() + "/src");
      genModel.setModelPluginID(project.getName());
      genModel.setRootExtendsInterface("");
      genModel.setSuppressEMFTypes(true);
      genModel.setImportOrganizing(true);
      
      // Set properties for generated package
      GenPackage genPackage = (GenPackage)genModel.getGenPackages().get(0);
      genPackage.setPrefix(genModelName);
      genPackage.setBasePackage(project.getName().substring(0, project.getName().lastIndexOf('.')));
      
      genPackage.getEcorePackage().setName("");		//TODO
      genPackage.getEcorePackage().setNsPrefix(""); 	//TODO
      genPackage.getEcorePackage().setNsURI("");   	//TODO
      
      
      
      
      return genModel;

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


示例4: createGenModel

import org.eclipse.emf.codegen.ecore.genmodel.GenJDKLevel; //导入依赖的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


示例5: createPropertiesDefinition

import org.eclipse.emf.codegen.ecore.genmodel.GenJDKLevel; //导入依赖的package包/类
public static String createPropertiesDefinition(Classifier classifier) throws Exception {		
	EPackage _package = EcoreFactory.eINSTANCE.createEPackage();
	EClass propertyDefinition = EcoreFactory.eINSTANCE.createEClass();
	GenModel genModel = GenModelFactory.eINSTANCE.createGenModel();
	ExtendedMetaData extendedMetaData = genModel.getExtendedMetaData();
	
	List<EStructuralFeature> features = new ArrayList<EStructuralFeature>();
	String propertiesDefinition = "";
	
	for(Property property : classifier.getAttributes()) {
		// consider attributes only if they aren't members of an association
		if(property.getAssociation() == null) {
			EAttribute attribute = EcoreFactory.eINSTANCE.createEAttribute();
			attribute.setName(property.getName());
			attribute.setUnsettable(true);
			
			// create an EEnum in case of enumeration
			if(property.getType() instanceof Enumeration) {
				Enumeration enumeration = (Enumeration) property.getType(); 
				EEnum eenumeration = EcoreFactory.eINSTANCE.createEEnum();
				eenumeration.setName(enumeration.getName());
				
				int literalValue = 0;
				for(EnumerationLiteral literal : enumeration.getOwnedLiterals()) {
					EEnumLiteral eliteral = EcoreFactory.eINSTANCE.createEEnumLiteral();
					eliteral.setName(literal.getName());
					eliteral.setValue(literalValue);
					literalValue++;
					eenumeration.getELiterals().add(eliteral);
				}
				
				_package.getEClassifiers().add(eenumeration);
				attribute.setEType(eenumeration);
			}
			else {
				attribute.setEType(XMLTypePackage.eINSTANCE.getString());
			}
			propertyDefinition.getEStructuralFeatures().add(attribute);
			extendedMetaData.setFeatureKind(attribute, ExtendedMetaData.ELEMENT_FEATURE);
			features.add(attribute);
		}
	}
	
	if(!features.isEmpty()) {
		// first step: create an Ecore metamodel		
		URI uri = URI.createFileURI(new File(Path + classifier.getName() + Ecore_Model_Fragment).getAbsolutePath());
		Resource resource = Resource_Set.createResource(uri);

		_package.setName(classifier.getName() + "Properties");
		_package.setNsPrefix(classifier.getName() + "Properties");
		_package.setNsURI("http://" + classifier.getName() + "Properties");
		resource.getContents().add(_package);
		propertyDefinition.setName("Properties");
		_package.getEClassifiers().add(propertyDefinition);
		
		// second step: derive the GenModel from the metamodel
		genModel.setComplianceLevel(GenJDKLevel.JDK70_LITERAL);		 
		genModel.setModelDirectory("");
		genModel.setModelName(_package.getName());
		genModel.initialize(Collections.singleton(_package));
			
		// third step: export the XSD from the GenModel			
		XSDExporter modelExporter = new XSDExporter();
		modelExporter.setGenModel(genModel);
		modelExporter.getEPackages().add(_package);
		EPackageConvertInfo convertInfo = modelExporter.getEPackageConvertInfo(_package);
		convertInfo.setConvert(true);
		EPackageExportInfo exportInfo = modelExporter.getEPackageExportInfo(_package);
		exportInfo.setArtifactLocation(Path + classifier.getName() + Xsd_Model_Fragment);
		modelExporter.export(null); 
		
		// the name of the properties definition; it allows node types to reference it
		propertiesDefinition = classifier.getName() + "Properties";
	}
	return propertiesDefinition;
}
 
开发者ID:alexander-bergmayr,项目名称:caml2tosca,代码行数:77,代码来源:ToscaUtil.java


示例6: setJdkLevel

import org.eclipse.emf.codegen.ecore.genmodel.GenJDKLevel; //导入依赖的package包/类
/**
 * Set the JDK compatibility level. The following values are valid:
 * <ul>
 *   <li>"JDK14"</li>
 *   <li>"JDK50"</li>
 *   <li>"JDK60"</li>
 *   <li>"JDK70"</li>
 *   <li>"JDK80"</li>
 * </ul>
 * The default level is "JDK60".
 */
public void setJdkLevel(final String jdkLevel) {
  this.jdkLevel = GenJDKLevel.getByName(jdkLevel);
  if ((this.jdkLevel == null)) {
    EMFGeneratorFragment2.LOG.warn(("Illegal JDK level: " + jdkLevel));
  }
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:18,代码来源:EMFGeneratorFragment2.java


示例7: setJdkLevel

import org.eclipse.emf.codegen.ecore.genmodel.GenJDKLevel; //导入依赖的package包/类
/**
 * Set the JDK compatibility level. The following values are valid:
 * <ul>
 *   <li>"JDK14"</li>
 *   <li>"JDK50"</li>
 *   <li>"JDK60"</li>
 *   <li>"JDK70"</li>
 *   <li>"JDK80"</li>
 * </ul>
 * The default level is "JDK60".
 * 
 * @since 2.8
 */
public void setJdkLevel(String jdkLevel) {
	GenJDKLevel l = GenJDKLevel.getByName(jdkLevel);
	Assert.isNotNull(l, "Invalid JDK level");
	this.jdkLevel = l;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:19,代码来源:EMFGeneratorFragment.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java JsonWriteContext类代码示例发布时间:2022-05-22
下一篇:
Java VideoPlayerActivity类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap