| How do I filter the result of AbstractDeclarativeScopeProvider.delegateGetScope()? [message #897741] |
Wed, 25 July 2012 03:57  |
Aaron Digulla Messages: 234 Registered: July 2009 Location: Switzerland |
Senior Member |
|
|
I have a language which allows to extend base models:
lib B extends A {}
When I try code completion after "extends", Xtext offers me "B" which doesn't make sense. So I wrote a method in ModelScopeProvider which extends AbstractDeclarativeScopeProvider:
public IScope scope_Lib_baseLib( Lib lib, EReference ref ) {
IScope delegateScope = delegateGetScope( lib, ref );
... remove "lib" from delegateScope ...
return delegateScope;
}
How do remove lib from delegateScope?
Regards,
A. Digulla
|
|
|
| Re: How do I filter the result of AbstractDeclarativeScopeProvider.delegateGetScope()? [message #897745 is a reply to message #897741] |
Wed, 25 July 2012 04:04   |
Aaron Digulla Messages: 234 Registered: July 2009 Location: Switzerland |
Senior Member |
|
|
Okay, I'm one step further:
public IScope scope_Lib_baseLib( Lib lib, EReference ref ) {
IScope delegateScope = delegateGetScope( lib, ref );
Predicate<IEObjectDescription> filter = new Predicate<IEObjectDescription>() {
@Override
public boolean apply( IEObjectDescription input ) {
return !input.getEObjectOrProxy().equals( lib );
}
};
result = new FilteringScope( delegateScope, filter );
return result;
}
Is this the correct way to compare an IEObjectDescription and an EObject to see whether they are equal?
Regards,
A. Digulla
[Updated on: Wed, 25 July 2012 04:14] Report message to a moderator
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02019 seconds