本文整理汇总了Java中org.eclipse.emf.codegen.ecore.genmodel.GenModel.setCopyrightText方法的典型用法代码示例。如果您正苦于以下问题:Java GenModel.setCopyrightText方法的具体用法?Java GenModel.setCopyrightText怎么用?Java GenModel.setCopyrightText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.emf.codegen.ecore.genmodel.GenModel
的用法示例。
在下文中一共展示了GenModel.setCopyrightText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generate
import org.eclipse.emf.codegen.ecore.genmodel.GenModel; //导入方法依赖的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;
}
示例2: createGenModel
import org.eclipse.emf.codegen.ecore.genmodel.GenModel; //导入方法依赖的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;
}
示例3: createGenModel
import org.eclipse.emf.codegen.ecore.genmodel.GenModel; //导入方法依赖的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;
}