Skip to main content



      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 09:22 Go to next message
Eclipse UserFriend
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 13:51 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: How to use FileResourceHandler in xtext web for importUri resolution [message #1829645 is a reply to message #1829623] Wed, 08 July 2020 04:47 Go to previous messageGo to next message
Eclipse UserFriend
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 04:52] by Moderator

Re: How to use FileResourceHandler in xtext web for importUri resolution [message #1829650 is a reply to message #1829645] Wed, 08 July 2020 05:27 Go to previous messageGo to next message
Eclipse UserFriend
having the opt and the D: make no sense
where do they come from?
Re: How to use FileResourceHandler in xtext web for importUri resolution [message #1829658 is a reply to message #1829650] Wed, 08 July 2020 07:16 Go to previous messageGo to next message
Eclipse UserFriend
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 16:32 Go to previous messageGo to next message
Eclipse UserFriend
Then ingress the goal is to have a d:
Unfortunately imdont have a Windows to test
Re: How to use FileResourceHandler in xtext web for importUri resolution [message #1829736 is a reply to message #1829684] Thu, 09 July 2020 14:25 Go to previous message
Eclipse UserFriend
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: Wed Jul 23 16:35:54 EDT 2025

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

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

Back to the top