Skip to main content



      Home
Home » Modeling » TMF (Xtext) » INode of unresolvable proxy EObjects
INode of unresolvable proxy EObjects [message #1745080] Tue, 04 October 2016 16:23 Go to next message
Eclipse UserFriend
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 16:25] by Moderator

Re: INode of unresolvable proxy EObjects [message #1745081 is a reply to message #1745080] Tue, 04 October 2016 16:36 Go to previous messageGo to next message
Eclipse UserFriend
Hi

can you tell what you want to do with the node? NodeModelUtils.findNodesForFeature(EObject, Feature) should give you the node
Re: INode of unresolvable proxy EObjects [message #1745083 is a reply to message #1745081] Tue, 04 October 2016 17:16 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: INode of unresolvable proxy EObjects [message #1745101 is a reply to message #1745083] Wed, 05 October 2016 04:12 Go to previous message
Eclipse UserFriend
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:Limit proposed Java types to certain packages(XText/XBase)
Next Topic:get a model from a grammar expression
Goto Forum:
  


Current Time: Wed Jul 23 15:55:07 EDT 2025

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

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

Back to the top