Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Model-to-Model Transformation » XTEND import function
XTEND import function [message #1785507] Mon, 16 April 2018 05:06 Go to next message
Zirui Zhu is currently offline Zirui ZhuFriend
Messages: 1
Registered: April 2018
Junior Member
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 15:37 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
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: Sat May 04 14:26:20 GMT 2024

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

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

Back to the top