Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext reference does work when importing a file
Xtext reference does work when importing a file [message #1386904] Sun, 22 June 2014 22:43 Go to next message
Félix SILINOU KAMDEM is currently offline Félix SILINOU KAMDEMFriend
Messages: 96
Registered: April 2013
Member
Hi,

I have reference on my grammar but when I am parsing an imported file I had errors like "Couldn't resolve reference".

It is strange because, when I am typing the same text directly in the editor, I do not have error.

Regards,
Felix
Re: Xtext reference does work when importing a file [message #1386911 is a reply to message #1386904] Mon, 23 June 2014 05:04 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13264
Registered: July 2009
Senior Member
HI,

can you give more context?

if parsing == reading in standalone mode this means you have to add all resources to the resourceset yourself.


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext reference does work when importing a file [message #1387061 is a reply to message #1386911] Mon, 23 June 2014 20:33 Go to previous messageGo to next message
Félix SILINOU KAMDEM is currently offline Félix SILINOU KAMDEMFriend
Messages: 96
Registered: April 2013
Member
Hi,

How can I set it manually?
Re: Xtext reference does work when importing a file [message #1387062 is a reply to message #1387061] Mon, 23 June 2014 20:37 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13264
Registered: July 2009
Senior Member
what do you have so far????


ResourceSet rs = ....
rs.getResource(URI.createURI("a.mydsl"), true);
...
rs.getResource(URI.createURI("z.mydsl"), true);


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Mon, 23 June 2014 20:37]

Report message to a moderator

Re: Xtext reference does work when importing a file [message #1387159 is a reply to message #1387062] Tue, 24 June 2014 14:15 Go to previous messageGo to next message
Félix SILINOU KAMDEM is currently offline Félix SILINOU KAMDEMFriend
Messages: 96
Registered: April 2013
Member
Hi, can you tell me which file I should modify.

I have tried something in .mw2 file
//var grammarURI = "classpath:/org/ramses/Ramses.xtext"
//grammarURI has to be platform:/resource as it is not on the classpath
var grammarURI = "platform:/resource/${projectName}/src/org/ramses/Ramses.xtext"

Workflow {
    bean = StandaloneSetup {
    // use an XtextResourceset throughout the process, which is able to resolve classpath:/ URIs.
   resourceSet = org.eclipse.xtext.resource.XtextResourceSet: theResourceSet {}
   ...
   uriMap = {
	  from = "platform:/resource/org.eclipse.xtext.xbase/"
	  to = "classpath:/"
   }
   uriMap = {
	  from = "platform:/resource/org.eclipse.xtext.common.types/"
	  to = "classpath:/"
   }
}}

component = Generator {
   ...
   language = auto-inject {
        // make sure we use the resourceSet created during standalone setup.
  	forcedResourceSet = theResourceSet
  
    	uri = grammarURI
   ....
}
}


But it still not working.
Re: Xtext reference does work when importing a file [message #1387169 is a reply to message #1387159] Tue, 24 June 2014 15:03 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13264
Registered: July 2009
Senior Member
Hi,

sorry this does not fit together.
i dont understand what this workflow has todo with "parsing"
can you explain.


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext reference does work when importing a file [message #1387170 is a reply to message #1387169] Tue, 24 June 2014 15:17 Go to previous messageGo to next message
Félix SILINOU KAMDEM is currently offline Félix SILINOU KAMDEMFriend
Messages: 96
Registered: April 2013
Member
Hummmmmm, it has nothing to do with parsing.
I was thinking that the ResourceSet should be manually modify in the workflow but I can realized that I was wrong.
Actually, I dont no exactly in which file I should modify the resourceSet Crying or Very Sad .
Re: Xtext reference does work when importing a file [message #1387172 is a reply to message #1387170] Tue, 24 June 2014 15:22 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13264
Registered: July 2009
Senior Member
Hi please elaborate what you actually want to do or achieve

Quote:
I have reference on my grammar but when I am parsing an imported file I had errors like "Couldn't resolve reference".

It is strange because, when I am typing the same text directly in the editor, I do not have error.


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Tue, 24 June 2014 15:42]

Report message to a moderator

Re: Xtext reference does work when importing a file [message #1387176 is a reply to message #1387172] Tue, 24 June 2014 16:01 Go to previous messageGo to next message
Félix SILINOU KAMDEM is currently offline Félix SILINOU KAMDEMFriend
Messages: 96
Registered: April 2013
Member
Hi, I want to parse an imported file.
Re: Xtext reference does work when importing a file [message #1387177 is a reply to message #1387176] Tue, 24 June 2014 16:05 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13264
Registered: July 2009
Senior Member
Still the question. What kind of file. What code do you execute. Standalone or in eclipse ...

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext reference does work when importing a file [message #1387179 is a reply to message #1387177] Tue, 24 June 2014 16:38 Go to previous messageGo to next message
Félix SILINOU KAMDEM is currently offline Félix SILINOU KAMDEMFriend
Messages: 96
Registered: April 2013
Member
What I am doing is:
- firstly generating a .rdsl file from java project (java.rdsl)
- secondly, I created a grammar which I can used to parse a .rdsl file
- finally when I am running Eclipse Instance and create a java Project, I copy and paste my file "java.rdsl"
In the editor, I have error from my file show they could not find reference for a specific element
http://i59.tinypic.com/71692s.jpg
Is that clear ?

The problem is tht I shouldn't have that error because when I am creating a new file directly on that Eclipse instance and typing the code I have in "java.rdsl" I do not have that error. I think that my code is not parse well.
http://i59.tinypic.com/312a05j.jpg
Re: Xtext reference does work when importing a file [message #1387180 is a reply to message #1387179] Tue, 24 June 2014 16:55 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13264
Registered: July 2009
Senior Member
Hi,

this is a scoping issues. once more we need a grammar (+ sample model files) to reproduce.


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Clean way to call out to external methods?
Next Topic:Error while running Xtext File cause by Eclipse
Goto Forum:
  


Current Time: Thu Dec 05 21:44:15 GMT 2019

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

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

Back to the top