Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to modify ContainerBasedScope in a SimpleScope way?
How to modify ContainerBasedScope in a SimpleScope way? [message #522320] Mon, 22 March 2010 06:30 Go to next message
Tim S. is currently offline Tim S.
Messages: 22
Registered: March 2010
Location: Hannover
Junior Member
Hello,

my primary subject is to get case insensitivity working on crossreferences.
So I bound my own linkingservice with these changes:

eObjectDescription = getContentByNameIgnoreCase(scope,s);
...
while (contents.hasNext()) {
IEObjectDescription element = contents.next();

if (name.equalsIgnoreCase(element.getName()))
return element;
}
...

But when reaching the ContainerBasedScope, i can't find the corresponding point where the names will be compared.

Does this indexing thing allow me to get this working in some way?


regards
Tim S.
Re: How to modify ContainerBasedScope in a SimpleScope way? [message #522341 is a reply to message #522320] Mon, 22 March 2010 08:50 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian Zarnekow
Messages: 2788
Registered: July 2009
Senior Member
Hi Tim,

wouldn't it be easier to configure an IQualifiedNameProvider that
produces only lowercase or uppercase names? Otherwise it'ld be hardly
possible to implement the query by name without iterating each and every
container.

I'ld decorate the IScope in your ScopeProvider and do something similar
to this pseudo code:

MyDslScopeProvider extends .. {

public IScope getScope(EObject, EReference) {
final IScope result = super.getScope(..);
return new IScope() {
IEObjectDescription getContentByName(String name) {
return result.getContentByName(name.toLowerCase());
}
IEObjectDescription getContentByEObject(EObject obj) {
IEObjectDescription = result.getContentByEObject(..);
// use the original name of the obj instead of the
// lowercase one
return new AliasedEObjectDescription(..);
}
// the other calls should return descriptions which expose
// their real name instead of the lowercase / uppercase version
...
}
}

}

Hope that helps.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 22.03.10 11:30, schrieb Tim S.:
> Hello,
>
> my primary subject is to get case insensitivity working on crossreferences.
> So I bound my own linkingservice with these changes:
>
> eObjectDescription = getContentByNameIgnoreCase(scope,s);
> ..
> while (contents.hasNext()) {
> IEObjectDescription element = contents.next();
>
> if (name.equalsIgnoreCase(element.getName())) return element;
> }
> ..
>
> But when reaching the ContainerBasedScope, i can't find the
> corresponding point where the names will be compared.
>
> Does this indexing thing allow me to get this working in some way?
>
Re: How to modify ContainerBasedScope in a SimpleScope way? [message #522378 is a reply to message #522341] Mon, 22 March 2010 10:10 Go to previous message
Tim S. is currently offline Tim S.
Messages: 22
Registered: March 2010
Location: Hannover
Junior Member
Thank you a lot,
I took your advice and resolved it with my QualifiedNameProvider. Smile


regards
Tim S.
Previous Topic:assigned value will possible override itself
Next Topic:Trying to subclass XTextResource
Goto Forum:
  


Current Time: Wed May 22 09:37:18 EDT 2013

Powered by FUDForum. Page generated in 0.03341 seconds