Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Cannot get localized label of MPart if it has been previously referenced by MPlaceholder
Cannot get localized label of MPart if it has been previously referenced by MPlaceholder [message #1573222] Mon, 19 January 2015 16:07 Go to next message
Jacek Bukowski is currently offline Jacek BukowskiFriend
Messages: 15
Registered: May 2014
Junior Member
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 #1574415 is a reply to message #1573222] Tue, 20 January 2015 07:50 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
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'?
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 08:21 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
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'?
>
Re: Cannot get localized label of MPart if it has been previously referenced by MPlaceholder [message #1574936 is a reply to message #1574457] Tue, 20 January 2015 14:29 Go to previous messageGo to next message
Jacek Bukowski is currently offline Jacek BukowskiFriend
Messages: 15
Registered: May 2014
Junior Member
Hi Tom,
Thanks a lot for extra-fast response and fix. I have reported problem in e4 here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=457939
Re: Cannot get localized label of MPart if it has been previously referenced by MPlaceholder [message #1576765 is a reply to message #1574936] Wed, 21 January 2015 14:07 Go to previous messageGo to next message
Jacek Bukowski is currently offline Jacek BukowskiFriend
Messages: 15
Registered: May 2014
Junior Member
I tried to test your patch, but it seems there is missing javafx.scene.layout import in org.eclipse.fx.ui.services MANIFEST.MF, right? The commit '9858cb' introduced AnchorePane dependency to GraphicsLoader, which is not imported in the manifest.

After I added the import, the fix is working, thanks.

Jacek
Re: Cannot get localized label of MPart if it has been previously referenced by MPlaceholder [message #1576773 is a reply to message #1576765] Wed, 21 January 2015 14:11 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
You are right i had not pushed this change :-( It's in the repo now

Tom

On 21.01.15 15:07, Jacek Bukowski wrote:
> I tried to test your patch, but it seems there is missing
> javafx.scene.layout import in org.eclipse.fx.ui.services MANIFEST.MF,
> right? The commit '9858cb' introduced AnchorePane dependency to
> GraphicsLoader, which is not imported in the manifest.
>
> After I added the import, the fix is working, thanks.
>
> Jacek
Re: Cannot get localized label of MPart if it has been previously referenced by MPlaceholder [message #1578517 is a reply to message #1576773] Thu, 22 January 2015 12:52 Go to previous message
Jacek Bukowski is currently offline Jacek BukowskiFriend
Messages: 15
Registered: May 2014
Junior Member
Thanks a lot. All works well! :
Previous Topic:Adding new perspective to existing perspective window in e4 RCP
Next Topic:Broken Link to Download Eclipse E4 0.17
Goto Forum:
  


Current Time: Sat Apr 20 02:41:03 GMT 2024

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

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

Back to the top