Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Label Provider not being invoked
Label Provider not being invoked [message #1844535] Thu, 16 September 2021 07:06 Go to next message
Horacio Hoyos is currently offline Horacio HoyosFriend
Messages: 242
Registered: October 2009
Location: Mexico
Senior Member

I customised the label provider for my DSL, but in the outline tree I don't get the labels I customised. While debugging, my custom methods never get called.

During debugging, I noticed that when creating nodes,
OutlineTreeProvicer#_text
, my custom label provider is an instance of IStyledLabelProvider, so instead of invoking the
ILabelProvider#getText
methods, it calls
IStyledLabelProvider#getStyledText
that does not call the custom getText methods.

Is this the intended behaviour? How can I get the styled label provider to use the custom getText methods? I see doGetText called, but not the getText ones.


Horacio Hoyos Rodriguez
Kinori Tech
Need professional support for Epsilon, EMF?
Go to: https://kinori.tech
Re: Label Provider not being invoked [message #1844537 is a reply to message #1844535] Thu, 16 September 2021 07:46 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14738
Registered: July 2009
Senior Member
can you provide a stacktace?

see also org.eclipse.xtext.ui.editor.outline.impl.DefaultOutlineTreeProvider._text(Object)
and similar places


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com

[Updated on: Thu, 16 September 2021 08:08]

Report message to a moderator

Re: Label Provider not being invoked [message #1844543 is a reply to message #1844537] Thu, 16 September 2021 10:51 Go to previous messageGo to next message
Horacio Hoyos is currently offline Horacio HoyosFriend
Messages: 242
Registered: October 2009
Location: Mexico
Senior Member

Thanks for the reply.
There is no exception, just the labels I defined not being used.

The org.eclipse.xtext.ui.editor.outline.impl.DefaultOutlineTreeProvider._text(Object) is the method I am looking at.

Is there some additional binding I need to do in the UI Module or else where? I think what I am missing is the part that does the dynamic dispatch to the specific text(XXX ele) for the ele's class.


Horacio Hoyos Rodriguez
Kinori Tech
Need professional support for Epsilon, EMF?
Go to: https://kinori.tech
Re: Label Provider not being invoked [message #1844544 is a reply to message #1844543] Thu, 16 September 2021 11:17 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14738
Registered: July 2009
Senior Member
i still cannot follow you. is _text(Object called or not
and what is your expectation. this code calls into your label provider, doesnt it?
so what is not working?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: Label Provider not being invoked [message #1844548 is a reply to message #1844544] Thu, 16 September 2021 12:01 Go to previous messageGo to next message
Horacio Hoyos is currently offline Horacio HoyosFriend
Messages: 242
Registered: October 2009
Location: Mexico
Senior Member

_text(Object) is called.

What is not working is that that method does not in turn call the String text(<Rule> ele) methods (I understood you gave to implement the text(<Rule> ele) method for each node that you want to customise)


Horacio Hoyos Rodriguez
Kinori Tech
Need professional support for Epsilon, EMF?
Go to: https://kinori.tech
Re: Label Provider not being invoked [message #1844550 is a reply to message #1844548] Thu, 16 September 2021 13:13 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14738
Registered: July 2009
Senior Member
of course it does not as it calls
MyDslLabelProvider.text(Greeting) line: 27	
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 62	
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43	
Method.invoke(Object, Object...) line: 566	
PolymorphicDispatcher<RT>.invoke(Object...) line: 303	
MyDslLabelProvider(DeclarativeLabelProvider).doGetText(Object) line: 52	
MyDslLabelProvider(DefaultEObjectLabelProvider).doGetText(Object) line: 36	
MyDslLabelProvider(AbstractLabelProvider).getStyledText(Object) line: 122	
MyDslOutlineTreeProvider(DefaultOutlineTreeProvider)._text(Object) line: 276	

why does the reflection in doGetText not work for you?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: Label Provider not being invoked [message #1844562 is a reply to message #1844550] Thu, 16 September 2021 14:43 Go to previous messageGo to next message
Horacio Hoyos is currently offline Horacio HoyosFriend
Messages: 242
Registered: October 2009
Location: Mexico
Senior Member

That is what I am trying to figure out! hehe.
MyDslLabelProvider.text(Greeting) line: 27	

never gets called.
The line called in MyDslLabelProvider is line 72, Object text(Object element), so its like the runtime dispatch is not working for some reason


Horacio Hoyos Rodriguez
Kinori Tech
Need professional support for Epsilon, EMF?
Go to: https://kinori.tech
Re: Label Provider not being invoked [message #1844563 is a reply to message #1844562] Thu, 16 September 2021 14:45 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14738
Registered: July 2009
Senior Member
then you need to debug the polymorphic dispatcher. sure you expanded the outline?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: Label Provider not being invoked [message #1844585 is a reply to message #1844563] Fri, 17 September 2021 06:43 Go to previous message
Horacio Hoyos is currently offline Horacio HoyosFriend
Messages: 242
Registered: October 2009
Location: Mexico
Senior Member

Hi,

It somehow resolved it self. I think it was linked to an imported metamodel not being found at runtime (i.e. EPackage not registered exception). Perhaps the label provider logic catches the exception and just returns null.


Horacio Hoyos Rodriguez
Kinori Tech
Need professional support for Epsilon, EMF?
Go to: https://kinori.tech
Previous Topic:Unable to create Eclipse Product from the sample MyDsl projects
Next Topic:Implicit Model Elements
Goto Forum:
  


Current Time: Sat Dec 14 09:44:45 GMT 2024

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

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

Back to the top