|
Re: Problem with Cross-Referencing and ProxyURIs [message #1752240 is a reply to message #1752236] |
Fri, 20 January 2017 08:57   |
|
The uri you are looking at is a "lazy URI" from Xtext. After parsing xtext installs proxies with uri's that contain all the needed information to, at a later point, resolve the link.
So it points to itself (the context), the EReference and the node (the text) of the cross reference.
It's not quite clear what the issue is that you have, but if you want to have the proxy resolved, you need to make sure you navigate the getter of the reference or call EcoreUtil.resolve.
If that still returns a proxy with the mentioned URI it means that it couldn't be resolved. I.e. the scoping didn't return an element.
Note that, the scope can be called differently from content assist and during linking, because the model might not be fully parseable so that the context might be different. Xtext tries to use the best context object it gets.
hth,
sven
[Updated on: Fri, 20 January 2017 08:59] Report message to a moderator
|
|
|
|
Re: Problem with Cross-Referencing and ProxyURIs [message #1752244 is a reply to message #1752243] |
Fri, 20 January 2017 09:22   |
|
I would write a test and then debug the issue.
During resolve your ScopeProvider will be called with the EObject containing the reference.
Make sure you return a scope object that contains an EObjectDescription with the correct name.
A good point for debugging such linking issues is `org.eclipse.xtext.linking.impl.DefaultLinkingService.getLinkedObjects(EObject, EReference, INode)`
|
|
|
Re: Problem with Cross-Referencing and ProxyURIs [message #1752247 is a reply to message #1752244] |
Fri, 20 January 2017 09:49   |
Simon BBBBBBB Messages: 63 Registered: March 2015 |
Member |
|
|
The method org.eclipse.xtext.linking.impl.DefaultLinkingService.getLinkedObjects(EObject, EReference, INode) is never called.
i also created a class that extends DefaultLinkingService and registered it in my RuntimeModule. The Constructor of that class is also never called.
i also noticed that in the moment where i try to get my model from my resource my getScope method is also not called. the getScope method is only called in the moment where i press STRG + Space
I guess it never gets resolved?
What am i doing wrong?
[Updated on: Fri, 20 January 2017 09:52] Report message to a moderator
|
|
|
|
Re: Problem with Cross-Referencing and ProxyURIs [message #1752257 is a reply to message #1752249] |
Fri, 20 January 2017 10:49   |
Simon BBBBBBB Messages: 63 Registered: March 2015 |
Member |
|
|
What Object? The final one?
EcoreUtil.resolveAll(xtextResource);
xtextResource.getContents().get(0);
and then i traverse to the point where my reference is.
or do you mean the one i use to create the scope? then this is the code:
EOperation eOperation = 'eobjectfrommyodel'.eContainer().eClass().getEOperations().get(0);
EList<EParameter> eParameters = eOperation.getEParameters();
if((context instanceof IParameterReference)) {
IParameterReference parameterReference = (IParameterReference) context;
if (reference.getName().equals("reference")){
return Scopes.scopeFor(eParameters);
}
}
[Updated on: Fri, 20 January 2017 10:53] Report message to a moderator
|
|
|
Re: Problem with Cross-Referencing and ProxyURIs [message #1752269 is a reply to message #1752257] |
Fri, 20 January 2017 13:19   |
|
I meant the "final one". I cannot tell based on your information why the Linking is not called on resolve, sorry.
I would step into the call to `myObject.getReference()` and see why the proxy is not resolved. It should go to `LazyLinkingResource.getEObject(String)` and then to the default linking service.
Please note that it tries to resolve a proxy only once. Afterward, it is marked as unresolvable and it won'T go into the previously mentioned method again.
|
|
|
|
Powered by
FUDForum. Page generated in 0.02567 seconds