Label Provider not being invoked [message #1844535] |
Thu, 16 September 2021 07:06  |
Eclipse User |
|
|
|
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 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.
|
|
|
|
Re: Label Provider not being invoked [message #1844543 is a reply to message #1844537] |
Thu, 16 September 2021 10:51   |
Eclipse User |
|
|
|
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.
|
|
|
|
Re: Label Provider not being invoked [message #1844548 is a reply to message #1844544] |
Thu, 16 September 2021 12:01   |
Eclipse User |
|
|
|
_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)
|
|
|
Re: Label Provider not being invoked [message #1844550 is a reply to message #1844548] |
Thu, 16 September 2021 13:13   |
Eclipse User |
|
|
|
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?
|
|
|
Re: Label Provider not being invoked [message #1844562 is a reply to message #1844550] |
Thu, 16 September 2021 14:43   |
Eclipse User |
|
|
|
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
|
|
|
|
Re: Label Provider not being invoked [message #1844585 is a reply to message #1844563] |
Fri, 17 September 2021 06:43  |
Eclipse User |
|
|
|
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.
|
|
|
Powered by
FUDForum. Page generated in 0.04115 seconds