Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to use FileResourceHandler in xtext web for importUri resolution(How to use FileResourceHandler in xtext web for importUri resolution)
How to use FileResourceHandler in xtext web for importUri resolution [message #1829600] Tue, 07 July 2020 13:22 Go to next message
aditya ilkal is currently offline aditya ilkalFriend
Messages: 4
Registered: July 2020
Junior Member
i am using xtext web to load dsl files from a custom path using FileResourceHandler, but when the file gets loaded in the ACE editor, the validation of cross references fail. the xtext-service/validate network call fails.

How can I configure dsl runtime to resolve importUri from custom path (for eg: /opt/xtext).
Re: How to use FileResourceHandler in xtext web for importUri resolution [message #1829623 is a reply to message #1829600] Tue, 07 July 2020 17:51 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13643
Registered: July 2009
Senior Member
hi, did you check the example code in

https://github.com/eclipse/xtext-web/tree/master/org.eclipse.xtext.web.example.jetty

e.g. https://github.com/eclipse/xtext-web/blob/master/org.eclipse.xtext.web.example.jetty/src/main/webapp/ace-statemachine-resource-multi.html


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to use FileResourceHandler in xtext web for importUri resolution [message #1829645 is a reply to message #1829623] Wed, 08 July 2020 08:47 Go to previous messageGo to next message
aditya ilkal is currently offline aditya ilkalFriend
Messages: 4
Registered: July 2020
Junior Member
Yes, I have checked the examples and have working code where both load and save services work. Using FileResourceHandler, I am able to specify the base directory of the dsl files (/opt/xtext/). I have also added ImportUriGlobalScopeProvider to runtime module, to resolve importUris.

But after the load service loads the file, the validation service does not compile the cross references.

The below is debug information of load/validate services for XtextWebDocument (com/example/dsl/Sample.mydsl). The problem is that the base url (/opt/xtext/) is not resolved in case of validation service, instead uses application launch path. If i copy dsl files to D:/Program%20Files/eclipse/eclipse, the cross referencing works.

Load service

org.eclipse.xtext.linking.lazy.LazyLinkingResource, uri='/opt/xtext/com/example/dsl/Sample.mydsl'
resourceset normalizationmap {/opt/xtext/com/example/dsl/Sample.mydsl=file:/opt/xtext/com/example/dsl/Sample.mydsl}

Validation service

org.eclipse.xtext.linking.lazy.LazyLinkingResource, uri='com/example/dsl/Sample.mydsl'
{com/example/dsl/Sample.mydsl=file:/D:/Program%20Files/eclipse/eclipse/com/example/dsl/Sample.mydsl}

[Updated on: Wed, 08 July 2020 08:52]

Report message to a moderator

Re: How to use FileResourceHandler in xtext web for importUri resolution [message #1829650 is a reply to message #1829645] Wed, 08 July 2020 09:27 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13643
Registered: July 2009
Senior Member
having the opt and the D: make no sense
where do they come from?


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to use FileResourceHandler in xtext web for importUri resolution [message #1829658 is a reply to message #1829650] Wed, 08 July 2020 11:16 Go to previous messageGo to next message
aditya ilkal is currently offline aditya ilkalFriend
Messages: 4
Registered: July 2020
Junior Member
I am only using this,
IResourceBaseProvider resourceBaseProvider = new ResourceBaseProviderImpl("/opt/xtext");

since it is windows system, the drive is getting resolved to d:, file path works with or without d: I guess. The main problem what I think is that the resource URI in validation service is different.
Re: How to use FileResourceHandler in xtext web for importUri resolution [message #1829684 is a reply to message #1829658] Wed, 08 July 2020 20:32 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13643
Registered: July 2009
Senior Member
Then ingress the goal is to have a d:
Unfortunately imdont have a Windows to test


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to use FileResourceHandler in xtext web for importUri resolution [message #1829736 is a reply to message #1829684] Thu, 09 July 2020 18:25 Go to previous message
aditya ilkal is currently offline aditya ilkalFriend
Messages: 4
Registered: July 2020
Junior Member
Thanks Christian for all the inputs, finally I got this working with flag "sendFullText : false".
For some reason I had the value set to 'true'. I believe it should have worked in this case also.
Previous Topic:Enum as attribute value
Next Topic:Bypass Xtend's IterableExtensions when there's a conflict
Goto Forum:
  


Current Time: Fri Oct 30 08:32:45 GMT 2020

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

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

Back to the top