[Xtext] Controlling import search path [message #49818] |
Wed, 10 June 2009 11:23  |
Eclipse User |
|
|
|
Hi,
I would like to be able to override the file location provided to the import
statement of my DSL. I need the ability to map the path to a different
physical one. Is there a straightforward way to achieve this?
For example, import "linux/server.vml", where the path needs to be
transformed to /{RepoDir}/vml/linux/server.vml.
Thanks
Derek
|
|
|
|
Re: [Xtext] Controlling import search path [message #49878 is a reply to message #49848] |
Wed, 10 June 2009 15:04  |
Eclipse User |
|
|
|
Hi Derek,
you may even try to simply override resolve() and
perform your transformation on the result of super.resolve().
Regards,
Sebastian
Am 10.06.2009 20:18 Uhr, schrieb Knut Wannheden:
> Hi Derek,
>
> Derek Palma wrote:
>> I would like to be able to override the file location provided to the
>> import statement of my DSL. I need the ability to map the path to a
>> different physical one. Is there a straightforward way to achieve this?
>>
>> For example, import "linux/server.vml", where the path needs to be
>> transformed to /{RepoDir}/vml/linux/server.vml.
>>
>
> I presume you're using the default import mechanism as described in the
> documentation
> (http://wiki.eclipse.org/Xtext/Documentation#Default_Imports). If that
> is the case then you should be able to override the ImportUriResolver.
> You do this by adding a binding to your XyzRuntimeModule like this:
>
> public Class<? extends ImportUriResolver> bindImportUriResolver() {
> return XyzImportUriResolver.class;
> }
>
> The XyzImportUriResolver class should then override the getResolver()
> method. The EObject passed to the resolver will be the Import object
> (i.e. the object with the "importURI" feature).
>
> Hope that helps,
>
> --knut
>
|
|
|
Powered by
FUDForum. Page generated in 0.07098 seconds