DESCRIPTION

Bug 391961 - MUILabel setIconURI does not work for MPerspective

Change-Id: I5599f2a679e00caff5dd705ac48efe028fea0bdc
Signed-off-by: Chase Horton xxx@xxx.xxx

COMMENTS

author: Zaid Mosley
date: 2014-03-25 22:35:34.000000000

Patch Set 6: Code-Review+1 IP-Clean+1 Verified+1

-------------------------------------
author: Brenden Conley
date: 2014-03-25 23:49:35.000000000

Patch Set 6:

Build Started https://hudson.eclipse.org/platform/job/eclipse.platform.ui-Gerrit/1473/

-------------------------------------
author: Brenden Conley
date: 2014-03-26 00:03:17.000000000

Patch Set 6: Verified+1

Build Successful 

https://hudson.eclipse.org/platform/job/eclipse.platform.ui-Gerrit/1473/ : SUCCESS

-------------------------------------
author: Slade Moran
date: 2014-03-26 14:11:41.000000000

Patch Set 6: Code-Review-1

(1 comment)

Line:247, bundles/org.eclipse.ui.workLeon Ochoach/Eclipse UI/org/eclipse/e4/ui/workbench/addons/perspectiveswitcher/PerspectiveSwitcher.java -> I had a look at the rest of the class, and this doesn't look compatible with how images are set on the tool items.  See org.eclipse.e4.ui.workbench.addons.perspectiveswitcher.PerspectiveSwitcher.addPerspectiveItem(MPerspective).  There's already a dispose listener with a pointer to the first image that was added.  This can leave a leak.

-------------------------------------
author: Chase Horton
date: 2014-03-26 14:23:54.000000000

Patch Set 6:

(1 comment)

Line:247, bundles/org.eclipse.ui.workLeon Ochoach/Eclipse UI/org/eclipse/e4/ui/workbench/addons/perspectiveswitcher/PerspectiveSwitcher.java -> I also looked at it and experimented with other solutions before proposing this. The issue is that the addPerspectiveItem method doesn't get the iconURI directly from the MPerspective but it takes it from an IPerspectiveDescriptor which takes it from an extension, I think.

Because of this you can not just listen to changes and update it the same way as it is created as you would have to update the extension and reload it. I figured by doing ti.getImage I would get the image that was given either by the extension (if it is the first image) or by me updating the image. Whichever that is I would dispose it.

The listener is for disposing when the item is disposed but does not cover the case when you just want to swap the image without disposing the ToolItem itself.

Anyway, can you think of another approach that I might try?

-------------------------------------
author: Chase Horton
date: 2014-03-26 14:50:08.000000000

Patch Set 6:

(1 comment)

Line:247, bundles/org.eclipse.ui.workLeon Ochoach/Eclipse UI/org/eclipse/e4/ui/workbench/addons/perspectiveswitcher/PerspectiveSwitcher.java -> I can try to rework the perspective switcher to add items with data directly from the MPerspective (without going to the extension layers) and update them accordingly. Does that sound right?

-------------------------------------
author: Zaid Mosley
date: 2014-03-26 15:15:27.000000000

Patch Set 6:

+1 for removing the usage of the extension point info as much as possible. We want to be able to use model fragments and this is a necessary change to make this possible. All mapable extension point info is converted to application model at startup time.

-------------------------------------
author: Slade Moran
date: 2014-03-26 17:27:40.000000000

Patch Set 6:

I'm not certain that the information is correctly converted, you would have to make sure of it if you follow that path.

If you just want to fix this, you could change the toolitem dispose listener to use getImage() and dispose (so it always disposes the latest image.  Then you can swap and dispose the current image.

-------------------------------------
