Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Issue with cross-referencing elements of other EMF model
icon5.gif  Issue with cross-referencing elements of other EMF model [message #1116385] Wed, 25 September 2013 06:55 Go to next message
Nieves Salor is currently offline Nieves Salor
Messages: 2
Registered: September 2013
Junior Member
Hello,
I am trying to create a grammar in XText based in an ANTLR one I had previously created. Also I have a EMF model containing information that is referred in this grammar, so I though to create the grammar directly in XText importing the ecore file of the existing model.
As I am doing little by little I have detected the issue at the beginning and I want to know if there is a solution before I continue as the grammar is huge.
The first grammar rules which are being problematic are:

EventDeclaration:
'<EVENT>' spaceSysObjName = ID ('<DESCRIPTION>' eventDescr = STRING '</DESCRIPTION>')? '</EVENT>';
Wait_statement:
'<WAIT>' '<EVENT>' event=[EventDeclaration] '<EVENT>'(saveContextStmt = SaveContext)? (timeout = Timeout)? '</WAIT>';


In this case when I am running the project, the cross reference is not verified and the validator raises the following issue:
Couldn't resolve reference to EventDeclaration 'event0'. with the example
<DECLARE><EVENT>event0</EVENT></DECLARE><PRECONDITIONS><WAIT><EVENT>event0<EVENT></WAIT></PRECONDITIONS>

However if instead of putting 'spaceSysObjName' I set 'name' as the name of the feature it works as expected. Why is that??

------------------------------------
My second problem, which for me it is more critical is that if I import an external EMF ecore file created from a parsin of a XSD file automatically and which works perfectly via the import mechanism (import "platform:/resource/SSMModel/model/ssm.ecore" as ssm), setting the reference in the StandaloneSetup (registerGeneratedEPackage = "ssm.model.ssm.ssmPackage"
registerGenModelFile = "platform:/resource/SSMModel/model/ssm_schema.genmodel"
) and in the buildpath the reference to the plugin project containng the ecore; I can compile without issues but when I try to open the editor it gives an error because of classNotFound related with the injector of the generated grammar.
Failed to create injector for com.vitrocisetbelgium.compiler.Pluto ExtensionFactory: compiler.ui.PlutoExecutableExtensionFactory
due to not finding the class of the imported EMF model
Error injecting method, java.lang.NoClassDefFoundError: ssm/model/ssm/ssmPackage

Can someone help me with this?? Because I have tried all methods and I am desperate...
Thanks in advance
Nieves
Re: Issue with cross-referencing elements of other EMF model [message #1116480 is a reply to message #1116385] Wed, 25 September 2013 10:05 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 5245
Registered: July 2009
Senior Member
Hi,

did you add a dependency (manifest.mf) to the plugin that contains ssmPackage (Sure it is a lower case s???)
Re: Issue with cross-referencing elements of other EMF model [message #1116485 is a reply to message #1116480] Wed, 25 September 2013 10:09 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 5245
Registered: July 2009
Senior Member
and to your first question: if you dont have an attribute with name "name" (a convention) you have to customize IQualifiedNameProvider (subclassing DefaultDeclarativeQualifiedNameProvider)
Re: Issue with cross-referencing elements of other EMF model [message #1117293 is a reply to message #1116485] Thu, 26 September 2013 05:29 Go to previous messageGo to next message
Nieves Salor is currently offline Nieves Salor
Messages: 2
Registered: September 2013
Junior Member
Hi Christian,
Thanks a lot for your answer Very Happy I added the dependency and also the plugin as external jar and re-create the artifacts launching it selecting the emf plugin to be loaded and now it does not result in any error.
However, sorry if it sounds dumb but another question for the future... I assume that for the references to be found I have to load (in this case a ssm) data resource (e.g. xmi one) in the same runtime application I launch when I execute the xtext editor. Where I should define this resource?? Am I mistaken or should be in the PlutoStandaloneSetupGenerated class?? There is no way to leave it configurable? As the idea is to be able to associate different reference SSM models depending to the PLUTO grammar example.

Regarding the name, many thanks I will test it now Very Happy
Re: Issue with cross-referencing elements of other EMF model [message #1117317 is a reply to message #1117293] Thu, 26 September 2013 05:59 Go to previous message
Christian Dietrich is currently offline Christian Dietrich
Messages: 5245
Registered: July 2009
Senior Member
Sry dont get this

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de
Previous Topic:Declarative scope provider disabling qualified namespace
Next Topic:Static in Xtend
Goto Forum:
  


Current Time: Mon Oct 07 10:36:48 EDT 2013

Powered by FUDForum. Page generated in 0.04071 seconds