2

I'm trying to perform a model-to-text transformation to html code using an IFML model. I have this mtl file:

[comment encoding = UTF-8 /]
[module main('http://www.omg.org/spec/IFML', 'http://www.omg.org/spec/IFML/core', 'http://www.omg.org/spec/IFML/ext')]

[template public generateElement(anIFMLModel : IFMLModel)]
[comment @main/]
[for (e1: InteractionFlowModelElement | anIFMLModel.interactionFlowModel.eContents())]
    [if (e1.oclIsTypeOf(ViewContainer))]
        [file ('/Pages/' + e1.oclAsType(ViewContainer).name + '.html', false, 'UTF-8')]
        <!DOCTYPE html>
        <html xmlns="http://www.w3.org/1999/xhtml">
        <header>
            <title>[ e1.oclAsType(ViewContainer).name /]</title>
        </header>
        <body>
            <p>hello World</p>
        </body> 
        </html>
        [/file] 
    [/if]
[/for]
[/template] 

The code is working if I run the transformation with the Acceleo plugin, but when I try to run as standalone, I get the error:

the type of the first parameter of the main template named generateElement is a proxy.

I have the metamodel in another project in the same workspace, but I tried export the project to jar and import in the acceleo project without success.

for the standalone I register the packages like this

resourceSet.getPackageRegistry().put(ifml.core.CorePackage.eINSTANCE.getNsURI(), ifml.core.CorePackage.eINSTANCE);
resourceSet.getPackageRegistry().put(ifml.extensions.ExtensionsPackage.eINSTANCE.getNsURI(), ifml.extensions.ExtensionsPackage.eINSTANCE);  

If I debug the code as java application, it stops when the exception throws and I check the argument type and it shows

org.eclipse.emf.ecore.impl.EClassImpl@2e554a3b (eProxyURI: http://www.omg.org/spec/IFML#/0/core/IFMLModel)

I don't know what else to check. Any help is appreciated

aleberguer
  • 370
  • 5
  • 13
  • Most likely reason is that the URI you've registered the core IFML metamodel with is not the correct one. Can you check that `ifml.core.CorePackage.eINSTANCE.getNsURI()` actually matches the proxy's URI `http://www.omg.org/spec/IFML`? – Kellindil Jun 08 '17 at 09:32

0 Answers0