Cannot get localized label of MPart if it has been previously referenced by MPlaceholder [message #1573222] |
Mon, 19 January 2015 11:07  |
Eclipse User |
|
|
|
Hi I have an application in which I build dynamically the user interface based on some recipe. It is done by having perspectives defined as snippets and all parts in window's shared elements. The perspectives then are cloned from snippets and filled with placeholders dynamically. The placeholders reference to the parts in shared elements.
One of the part needs to display all available parts, so basically it retrieves all MParts from shared elements and display them using MPart.getLocalizedLabel(). It all works fine if the parts haven't been attached to any placeholder yet or they are assigned by they are visible in the same perspective. If I try to get localized label of the part which previously was referenced by the placeholder, I get just key (so exactly the same as MPart.getLabel()).
After debugging it seems that the problem is that 'Cur Shared Ref' of the part is never cleared even if corresponding placeholder is removed from the model (e.g. by EModelService.removePerspectiveModel()). LocalizationHelper.getLocalized() uses ModelUtils.getContainingContext(). That has a special if-case for parts attached to placeholders, but the context of the placeholder is null in my case. I have checked with both SWT renderers and JavaFX renderers.
If I just manually set null to 'Cur Shared Ref', then retrieving localized label works fine. I assume it is not something I should bother, right? Is there any way to properly unrender perspectives with placeholders to clear 'Cur Shared Ref'?
|
|
|
|
Re: Cannot get localized label of MPart if it has been previously referenced by MPlaceholder [message #1574457 is a reply to message #1574415] |
Tue, 20 January 2015 03:21   |
Eclipse User |
|
|
|
Hi,
I had just a few minutes and looked into it from the e(fx)clipse side
and the fix has to happen in the toolkit specific renderers.
So please file a bug against platform to fix it. For JavaFX rendering
this has been fixed with
https://bugs.eclipse.org/bugs/show_bug.cgi?id=457900 and
http://git.eclipse.org/c/efxclipse/org.eclipse.efxclipse.git/commit/?id=372d25a64383e208f3ef4b12782b0ee9b37735af
Tom
On 20.01.15 08:50, Tom Schindl wrote:
> Hi,
>
> This definately sounds like a bug - can you at least file a bug against
> the JavaFX renders and then I can investigate and maybe assign upwards
> to platform and fix the bug there.
>
> Tom
>
> On 19.01.15 17:07, Jacek Bukowski wrote:
>> Hi I have an application in which I build dynamically the user interface
>> based on some recipe. It is done by having perspectives defined as
>> snippets and all parts in window's shared elements. The perspectives
>> then are cloned from snippets and filled with placeholders dynamically.
>> The placeholders reference to the parts in shared elements.
>> One of the part needs to display all available parts, so basically it
>> retrieves all MParts from shared elements and display them using
>> MPart.getLocalizedLabel(). It all works fine if the parts haven't been
>> attached to any placeholder yet or they are assigned by they are visible
>> in the same perspective. If I try to get localized label of the part
>> which previously was referenced by the placeholder, I get just key (so
>> exactly the same as MPart.getLabel()).
>>
>> After debugging it seems that the problem is that 'Cur Shared Ref' of
>> the part is never cleared even if corresponding placeholder is removed
>> from the model (e.g. by EModelService.removePerspectiveModel()).
>> LocalizationHelper.getLocalized() uses
>> ModelUtils.getContainingContext(). That has a special if-case for parts
>> attached to placeholders, but the context of the placeholder is null in
>> my case. I have checked with both SWT renderers and JavaFX renderers.
>>
>> If I just manually set null to 'Cur Shared Ref', then retrieving
>> localized label works fine. I assume it is not something I should
>> bother, right? Is there any way to properly unrender perspectives with
>> placeholders to clear 'Cur Shared Ref'?
>
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05587 seconds