Cross Reference(Lazy linking) [message #902942] |
Tue, 21 August 2012 06:43  |
Eclipse User |
|
|
|
Hi,
In my dsl I have a cross reference between files and the references between files are sometimes not working. The Lazy linking doesn't return "sometimes" the objects on demand, therefore I have to explicitly resolve the proxy in scopeprovider. Is there another way to solve this problem?
List<Composite> composites = new ArrayList<Composite>();
if (context.getScreenType().eIsProxy()) {
EObject e = EcoreUtil2.resolve(context.getScreenType(), new ResourceSetImpl());
composites = EcoreUtil2.eAllOfType(e, Composite.class);
}
IScope result1 = MapBasedScope.createScope(IScope.NULLSCOPE, Scopes.scopedElementsFor(composites));
return result1;
And my dsl looks like:
Model:
(screenType=ScreenType | fbType=FbType);
ScreenType:
"screenType" name=ID
screen=Screen;
Screen:
"screen" name=STRING "{"
(rootComposite=Composite)?
"}";
Composite:
{Composite}
"composite" (name=ID)? "{"
composites+=Composite*
"}";
FbType:
(faceplateInstances+=FaceplateInstance)*;
FaceplateInstance:
"faceplateInstance" name=STRING "{"
"on screenType" screenType=[ScreenType|QualifiedName]
"in composite" composite=[Composite|QualifiedName]
|
|
|
|
|
Re: Cross Reference(Lazy linking) [message #903035 is a reply to message #903009] |
Tue, 21 August 2012 13:32  |
Eclipse User |
|
|
|
On 2012-21-08 17:32, Necip Karakas wrote:
> Hi Henrik,
> Thanks for your help. You are right about what I am trying to do. But my
> main problem is, even if I dont resolve the proxies heavily as I
> mentioned, it kind of resolves the references(it appears no problem in
> Eclipse) but the content assist not working and sometimes it is working
> completely. I do not understand the inconsistency of Xtext at resolving
> proxies. Therefore I thought that something is missing in my grammar.
Nope, it depends on build order, caches, units of work executed, lazy
linking, if you are looking at a possibly dirty resource (in the
editor), if the other resource is dirty, or not etc.
Use of index should be good for this kind of thing.
- henrik
|
|
|
Powered by
FUDForum. Page generated in 0.05564 seconds