Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » QualifiedNameProvider ends up in cyclic resolution, when referring to object of other resource(QualifiedNameProvider ends up in cyclic resolution, when referring to object of other resource)
QualifiedNameProvider ends up in cyclic resolution, when referring to object of other resource [message #1785512] Mon, 16 April 2018 06:54 Go to next message
Girish Kumar is currently offline Girish KumarFriend
Messages: 48
Registered: May 2011
Member
Hi All,

I want to actually reference a unnamed Object.

My Grammar is something like this

MyModel:
clientConfig+=ClientConfiguration*;

ClientConfiguration:
'Client' name=ID
'{'
(
states+=ComponentState*
'}';

ComponentState:
'State' state=[coom::State|FQN]
'{'
(stateDependency=StateDependency)?
'}';

StateDependency:
'depends on states' states+=[ComponentState|FQN] (',' states+=[ComponentState|FQN])*;

My Model Should look like this

Client Client1 {
State S1 {
}
}

Client Client2 {
State S1 {
depends on states Client1.S1 //Client name + State name
}
}

I tried to implement IQualifiedNameProvider
class StatesQualifiedNameProvider extends DefaultDeclarativeQualifiedNameProvider {

def QualifiedName qualifiedName(ComponentState cs){
val cc = cs.eContainer() as ClientConfiguration
return QualifiedName.create(cc.name, cs.state.name);
}
}

But with this i run in to this
org.eclipse.xtext.linking.lazy.LazyLinkingResource$CyclicLinkingException: Cyclic resolution of lazy links : ComponentState.state->ClientConfiguration.coomRef->ComponentState.state in resource 'platform:/resource/Test/src/Test.nsd'.

Any ways i can get this done

[Updated on: Mon, 16 April 2018 06:55]

Report message to a moderator

Re: QualifiedNameProvider ends up in cyclic resolution, when referring to object of other resource [message #1785513 is a reply to message #1785512] Mon, 16 April 2018 06:58 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Him

you should NodeModelutils (findNodeForFeature) to obtain cross reference texts in IQualifiedNameProvider.


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: QualifiedNameProvider ends up in cyclic resolution, when referring to object of other resource [message #1785514 is a reply to message #1785513] Mon, 16 April 2018 07:18 Go to previous messageGo to next message
Girish Kumar is currently offline Girish KumarFriend
Messages: 48
Registered: May 2011
Member
NodeModelutils does not have any api with findNodeForFeature

However, I can see findNodesForFeature
Below is how i tried but it gives me back ComponentState

val findNodesForFeature = NodeModelUtils.findNodesForFeature(cs,StatesPackage.Literals.COMPONENT_STATE__STATE).head
val findActualSemanticObjectFor = NodeModelUtils.findActualSemanticObjectFor(findNodesForFeature)

Can you share me any example
Re: QualifiedNameProvider ends up in cyclic resolution, when referring to object of other resource [message #1785517 is a reply to message #1785514] Mon, 16 April 2018 07:37 Go to previous messageGo to next message
Girish Kumar is currently offline Girish KumarFriend
Messages: 48
Registered: May 2011
Member
Thanks Christian, It works but i get an extra space, which i can deal with
def QualifiedName qualifiedName(ComponentState cs) {
val cc = cs.eContainer() as ClientConfiguration
val text = NodeModelUtils.findNodesForFeature(cs, StatesPackage.Literals.COMPONENT_STATE__STATE).head.text.trim
return QualifiedName.create(cc.name, text)
}
Re: QualifiedNameProvider ends up in cyclic resolution, when referring to object of other resource [message #1785518 is a reply to message #1785517] Mon, 16 April 2018 07:41 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
yes this is that i meant

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:issue with findActualNodeFor and what it returns from an old version of the Resource
Next Topic:DSL with Multiline String as in YAML
Goto Forum:
  


Current Time: Thu Apr 25 13:21:56 GMT 2024

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

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

Back to the top