Skip to main content



      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 02:54 Go to next message
Eclipse UserFriend
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 02:55] by 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 02:58 Go to previous messageGo to next message
Eclipse UserFriend
Him

you should NodeModelutils (findNodeForFeature) to obtain cross reference texts in IQualifiedNameProvider.
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 03:18 Go to previous messageGo to next message
Eclipse UserFriend
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 03:37 Go to previous messageGo to next message
Eclipse UserFriend
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 03:41 Go to previous message
Eclipse UserFriend
yes this is that i meant
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: Sat Jun 14 21:05:21 EDT 2025

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

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

Back to the top