|
18 | 18 | import org.eclipse.acceleo.engine.event.IAcceleoTextGenerationListener; |
19 | 19 | import org.eclipse.acceleo.engine.generation.strategy.IAcceleoGenerationStrategy; |
20 | 20 | import org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator; |
21 | | -import org.eclipse.cmf.occi.core.OCCIPackage; |
22 | | -import org.eclipse.cmf.occi.docker.DockerFactory; |
23 | | -import org.eclipse.cmf.occi.docker.DockerPackage; |
24 | | -import org.eclipse.cmf.occi.infrastructure.InfrastructurePackage; |
25 | 21 | import org.eclipse.emf.common.util.BasicMonitor; |
26 | 22 | import org.eclipse.emf.common.util.Monitor; |
27 | 23 | import org.eclipse.emf.common.util.URI; |
28 | 24 | import org.eclipse.emf.ecore.EObject; |
29 | 25 | import org.eclipse.emf.ecore.resource.ResourceSet; |
30 | | -import org.eclipse.emf.ecore.util.EcoreUtil; |
31 | | -import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl; |
32 | 26 |
|
33 | 27 | /** |
34 | 28 | * Entry point of the 'Generate' generation module. |
@@ -346,33 +340,33 @@ public String[] getTemplateNames() { |
346 | 340 | @Override |
347 | 341 | public void registerPackages(ResourceSet resourceSet) { |
348 | 342 | super.registerPackages(resourceSet); |
349 | | - // The following doesnt work same message as described below. |
350 | | - resourceSet.getPackageRegistry().put(OCCIPackage.eNS_URI, |
351 | | - OCCIPackage.eINSTANCE); |
352 | | - resourceSet.getPackageRegistry().put(InfrastructurePackage.eNS_URI, |
353 | | - InfrastructurePackage.eINSTANCE); |
354 | | - resourceSet.getPackageRegistry().put(DockerPackage.eNS_URI, |
355 | | - DockerPackage.eINSTANCE); |
| 343 | + if (!isInWorkspace(org.eclipse.emf.ecore.EcorePackage.class)) { |
| 344 | + resourceSet.getPackageRegistry().put(org.eclipse.emf.ecore.EcorePackage.eINSTANCE.getNsURI(), org.eclipse.emf.ecore.EcorePackage.eINSTANCE); |
| 345 | + } |
| 346 | +// // The following doesnt work same message as described below. |
| 347 | +// resourceSet.getPackageRegistry().put(OCCIPackage.eNS_URI, |
| 348 | +// OCCIPackage.eINSTANCE); |
| 349 | +// resourceSet.getPackageRegistry().put(InfrastructurePackage.eNS_URI, |
| 350 | +// InfrastructurePackage.eINSTANCE); |
| 351 | +// resourceSet.getPackageRegistry().put(DockerPackage.eNS_URI, |
| 352 | +// DockerPackage.eINSTANCE); |
356 | 353 |
|
357 | 354 | // Other try with acceleo forum comments in forums, the following doesnt work... |
358 | 355 | // Message : !MESSAGE The generation failed to generate any file because there are no model elements that matches at least the type of the first parameter of one of your main templates. |
359 | 356 | // The problem may be caused by a problem with the registration of your metamodel, please see the method named "registerPackages" in the Java launcher of your generator. It could also come from a missing [comment @main/] |
360 | 357 | // in the template used as the entry point of the generation. |
361 | | - if (!isInWorkspace(OCCIPackage.class)) { |
362 | | - // The normal package registration if your metamodel is in a plugin. |
363 | | - resourceSet.getPackageRegistry().put(OCCIPackage.eNS_URI, OCCIPackage.eINSTANCE); |
364 | | - } |
365 | | - if (!isInWorkspace(InfrastructurePackage.class)) { |
| 358 | + if (!isInWorkspace(org.eclipse.cmf.occi.core.OCCIPackage.class)) { |
366 | 359 | // The normal package registration if your metamodel is in a plugin. |
367 | | - resourceSet.getPackageRegistry().put(InfrastructurePackage.eNS_URI, InfrastructurePackage.eINSTANCE); |
| 360 | + resourceSet.getPackageRegistry().put(org.eclipse.cmf.occi.core.OCCIPackage.eNS_URI, org.eclipse.cmf.occi.core.OCCIPackage.eINSTANCE); |
368 | 361 | } |
369 | | - if (!isInWorkspace(InfrastructurePackage.class)) { |
| 362 | + if (!isInWorkspace(org.eclipse.cmf.occi.infrastructure.InfrastructurePackage.class)) { |
370 | 363 | // The normal package registration if your metamodel is in a plugin. |
371 | | - resourceSet.getPackageRegistry().put(InfrastructurePackage.eNS_URI, InfrastructurePackage.eINSTANCE); |
| 364 | + resourceSet.getPackageRegistry().put(org.eclipse.cmf.occi.infrastructure.InfrastructurePackage.eNS_URI, org.eclipse.cmf.occi.infrastructure.InfrastructurePackage.eINSTANCE); |
372 | 365 | } |
373 | | - if (!isInWorkspace(DockerPackage.class)) { |
| 366 | + |
| 367 | + if (!isInWorkspace(org.eclipse.cmf.occi.docker.DockerPackage.class)) { |
374 | 368 | // The normal package registration if your metamodel is in a plugin. |
375 | | - resourceSet.getPackageRegistry().put(DockerPackage.eNS_URI, DockerPackage.eINSTANCE); |
| 369 | + resourceSet.getPackageRegistry().put(org.eclipse.cmf.occi.docker.DockerPackage.eNS_URI, org.eclipse.cmf.occi.docker.DockerPackage.eINSTANCE); |
376 | 370 | } |
377 | 371 | // EcoreUtil.resolveAll(resourceSet); |
378 | 372 |
|
|
0 commit comments