Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Loading a file from ScopeProvider
Loading a file from ScopeProvider [message #1714932] Tue, 17 November 2015 17:40 Go to next message
Anakreontas Mentis is currently offline Anakreontas MentisFriend
Messages: 85
Registered: October 2014
Member
The DSL I'm working on has some rudimentary object oriented features. One creates an object with a special method as follows:
load(name,"object\myobject.obj") //construct object
name.someMethod()//call a metho

where name is the object name and the second argument points to the object implementation.

In the scope provider I try to load the implementation file as follows:
def scopeObjectMethod(ObjectMethod method) {
.....
val uri = reslover.doResolve(method.eResource, path) //URI is correct
val rs = method.eResource.resourceSet //Same resource set as the object method
try {
  rs.getResource(uri, true)
} catch (Exception ex) {
  println('Error:' + ex.message) //produces Error:org.xml.sax.SAXParseException
}


ResourceSet expects an XMI file, when in fact is a file in the same DSL. This is strange since the .obj' extension is registered to my DSL.

How can I instruct ResourceSet to expect a file of my DSL instead of XMI?

Regards
Re: Loading a file from ScopeProvider [message #1715014 is a reply to message #1714932] Wed, 18 November 2015 13:40 Go to previous message
Anakreontas Mentis is currently offline Anakreontas MentisFriend
Messages: 85
Registered: October 2014
Member
Turned out that the extension of object files (.obj) was not registered properly in ui/plugin.xml. Some parts had the correct extension (/plugin/extension/editor) while /plugin/extension/parser had a different extension from a previous experiment.
Previous Topic:How to highlight an Xtext cross-reference differently for targets of different types?
Next Topic:Can't upgrade to 2.9 rc1 or rc2
Goto Forum:
  


Current Time: Fri Apr 26 02:43:21 GMT 2024

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

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

Back to the top