Skip to main content



      Home
Home » Modeling » Model-to-Model Transformation » XTEND import function
XTEND import function [message #1785507] Mon, 16 April 2018 01:06 Go to next message
Eclipse UserFriend
in my xtext:

Import:
'import' importedNamespace=QualifiedNameWithWildcard;

What I want to do is to fulfil the import function.

For example,

this is my DSL:
package "mypackage" {
import "test.txt"
suite test
...
end
}


test.txt:
package "mypackage2" {
suite test2
...
end
}

What I want to do is to run the code in test.txt.
but the code belows doesn't work:
var r = new ResourceFactoryImpl().createResource(URI.createFileURI(i.importedNamespace))
doGenerate(r, fsa, context)

it throws NullPointerExcption.

Did I miss something important in my code? like registry.
What should I do, thx
Re: XTEND import function [message #1785632 is a reply to message #1785507] Tue, 17 April 2018 11:37 Go to previous message
Eclipse UserFriend
Hi

(Xtend correpondence usually hangs out on the Xtext or M2T forums.)

Very difficult to answer with such fragmentary repo, so I can just answer that new ResourceFactoryImpl().createResource looks really smelly. Use a ResourceSet.

So does URI.createFileURI(i.importedNamespace) but maybe importedNamespace is not what I expect.

Regards

Ed Willink
Previous Topic:[QVTo] Constructor calling constructor
Next Topic:M2M from UML to REST
Goto Forum:
  


Current Time: Tue Jul 08 08:28:54 EDT 2025

Powered by FUDForum. Page generated in 0.06216 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top