Java Code Examples for org.eclipse.emf.codegen.ecore.genmodel.GenModel#setModelDirectory()
The following examples show how to use
org.eclipse.emf.codegen.ecore.genmodel.GenModel#setModelDirectory() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DataObjectGenerator.java From BIMserver with GNU Affero General Public License v3.0 | 5 votes |
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; }
Example 2
Source File: EMFGeneratorFragment2.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
protected GenModel getGenModel(final ResourceSet rs, final Grammar grammar) { try { final URI genModelUri = this.getGenModelUri(grammar); final Resource resource = rs.getResource(genModelUri, false); if ((resource != null)) { resource.unload(); rs.getResources().remove(resource); } final Resource genModelFile = rs.createResource(genModelUri, ContentHandler.UNSPECIFIED_CONTENT_TYPE); GenModel genModel = null; boolean _exists = rs.getURIConverter().exists(genModelUri, null); if (_exists) { genModelFile.load(null); boolean _hasFragment = genModelUri.hasFragment(); if (_hasFragment) { EObject _eObject = genModelFile.getEObject(genModelUri.fragment()); genModel = ((GenModel) _eObject); } else { EObject _head = IterableExtensions.<EObject>head(genModelFile.getContents()); genModel = ((GenModel) _head); } } else { genModel = new GenModelImpl() { @Override public GenPackage createGenPackage() { return new GenPackageImpl() { @Override public String getSerializedPackageFilename() { String _name = this.getName(); return (_name + ".loadinitialization_ecore"); } }; } }; genModel.setModelName(this.getModelName(grammar)); genModel.setModelPluginID(this.getModelPluginID()); genModel.setModelDirectory(this.getJavaModelDirectory()); if (this.generateEdit) { genModel.setEditPluginID(this.getEditPluginID()); genModel.setEditDirectory(this.getEditDirectory()); } if (this.generateEditor) { genModel.setEditorPluginID(this.getEditorPluginID()); genModel.setEditorDirectory(this.getEditorDirectory()); } genModel.setValidateModel(false); genModel.setForceOverwrite(true); genModel.setFacadeHelperClass(null); genModel.setBundleManifest(true); genModel.setUpdateClasspath(false); genModel.setComplianceLevel(this.jdkLevel); genModel.setRuntimeVersion(this.emfRuntimeVersion); genModel.setRootExtendsClass(this.rootExtendsClass); genModel.setLineDelimiter(this.codeConfig.getLineDelimiter()); String _fileHeader = this.codeConfig.getFileHeader(); boolean _tripleNotEquals = (_fileHeader != null); if (_tripleNotEquals) { genModel.setCopyrightText(this.trimMultiLineComment(this.codeConfig.getFileHeader())); } } genModelFile.getContents().add(genModel); return genModel; } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }