|
|
Re: [acceleo]static uml profile registration [message #836435 is a reply to message #804306] |
Wed, 04 April 2012 13:39 |
saadia dhouib Messages: 36 Registered: April 2010 |
Member |
|
|
Hi Stephane,
I have tried to modify registerPackages method as you mentioned but I still have the error:
!ENTRY org.eclipse.acceleo.engine 2 0 2012-04-04 15:10:36.410
!MESSAGE The generation fail 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.
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.
Here is my code:
public static final String PROFILES_PATHMAP = "pathmap://Toto_PROFILES/"; //$NON-NLS-1$
public static final String Toto_PROFILE_URI = PROFILES_PATHMAP + "TotoProfile.profile.uml"; //$NON-NLS-1$
public void registerPackages(ResourceSet resourceSet) {
super.registerPackages(resourceSet);
//
EPackage.Registry packageRegistry = resourceSet.getPackageRegistry();
Resource.Factory.Registry factoryRegistry = resourceSet.getResourceFactoryRegistry();
//Map<URI, URI> uriMap = resourceSet.getURIConverter().getURIMap();
//
if(!isInWorkspace(org.eclipse.uml2.uml.UMLPackage.class)) {
resourceSet.getPackageRegistry().put(org.eclipse.uml2.uml.UMLPackage.eINSTANCE.getNsURI(), org.eclipse.uml2.uml.UMLPackage.eINSTANCE);
factoryRegistry.getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
}
URI uri = URI.createURI(Toto_PROFILE_URI);
// TODO If you need additional package registrations, do them here. The following line is an example for UML.
resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
resourceSet.getPackageRegistry().put(TotoPackage.eINSTANCE.getNsURI(), TotoPackage.eINSTANCE);
System.err.println("uri : " + uri);
Map uriMap = resourceSet.getURIConverter().getURIMap();
uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP), uri);
}
|
|
|
Powered by
FUDForum. Page generated in 0.03382 seconds