Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » INode of unresolvable proxy EObjects
INode of unresolvable proxy EObjects [message #1745080] Tue, 04 October 2016 20:23 Go to next message
Mehmet Karaman is currently offline Mehmet KaramanFriend
Messages: 63
Registered: November 2012
Location: Berlin
Member
Hello,

is it possible to get the INode of an unresolvable element? NodeModelUtils.getNode(..) returns null. I've started iterating from the root Node and compared their semantic element with the proxy EObject, but their fragments differ:
- unresolvable objects fragment: #|4
- List<INode> feature = NodeModelUtils.findNodesForFeature(EObject, Feature): ... (gathered the Semantic Element) #//@nodes.0

So i can't match them, to find the corresponding INode. What is the appropriate way to achieve this? Thanks in advance.

Best regards
Mehmet

[Updated on: Tue, 04 October 2016 20:25]

Report message to a moderator

Re: INode of unresolvable proxy EObjects [message #1745081 is a reply to message #1745080] Tue, 04 October 2016 20:36 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi

can you tell what you want to do with the node? NodeModelUtils.findNodesForFeature(EObject, Feature) should give you the node


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: INode of unresolvable proxy EObjects [message #1745083 is a reply to message #1745081] Tue, 04 October 2016 21:16 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
of course you could do the same as the linking does

org.eclipse.xtext.linking.lazy.LazyLinkingResource.getEObject(String)

if (r instanceof LazyLinkingResource) {
LazyLinkingResource lazyLinkingResource = (LazyLinkingResource)r;
if (lazyLinkingResource.getEncoder().isCrossLinkFragment(lazyLinkingResource, eProxyURI.fragment())) {
Triple<EObject, EReference, INode> triple = lazyLinkingResource.getEncoder().decode(lazyLinkingResource, eProxyURI.fragment());
System.out.println(triple.getThird().getText());
}
}

but i doubt thats neccessary


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: INode of unresolvable proxy EObjects [message #1745101 is a reply to message #1745083] Wed, 05 October 2016 08:12 Go to previous message
Mehmet Karaman is currently offline Mehmet KaramanFriend
Messages: 63
Registered: November 2012
Location: Berlin
Member
I am viewing the objects in a tree viewer and the unresolved objects are visible but don't contain any information. I want to show the text of these INodes + "(Proxy)" to inform the user, that these objects could not be resolved. The code above worked for me. Thank you.
Previous Topic:absolute paths in ._trace files
Next Topic:get a model from a grammar expression
Goto Forum:
  


Current Time: Thu Mar 28 13:28:14 GMT 2024

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

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

Back to the top