Bug 510826

Summary: getSectionGradientImage in FormImages always returns a new image although it already has one in the cache
Product: [Eclipse Project] Platform Reporter: Ralf Petter <ralf.petter>
Component: UIAssignee: Ralf Petter <ralf.petter>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: Lars.Vogel
Version: 4.7   
Target Milestone: 4.7 M6   
Hardware: PC   
OS: Windows NT   
See Also: https://git.eclipse.org/r/89292
https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=947da1ec54e12be2b88c828c02c5d978b40eb8a4
Whiteboard:
Bug Depends on:    
Bug Blocks: 510228, 510830    

Description Ralf Petter CLA 2017-01-22 05:34:35 EST
The getSectionGradientImage in org.eclipse.ui.internal.forms.widgets.FormImages has code to cache created gradient images, but this does not work because the equals method of the nested private class SimpleSectionImageDescriptor is not implemented properly. The method should check whether the parameter is instance of SimpleSectionImageDescriptor and not SimpleImageDescriptor. I think this is a copy&paste error.

I have written a JUnit test to check for this problem and provided a improved version of FormImages to correct this problem. This fix is also needed to fix Bug 510228
Comment 1 Ralf Petter CLA 2017-01-22 05:55:28 EST
I have made some performance tests and this patch improves the performance of resize operations on a simple shell with a form and a section by approximately 13%.
Comment 2 Ralf Petter CLA 2017-01-22 12:34:33 EST
New Gerrit change created: https://git.eclipse.org/r/89292/
Comment 4 Lars Vogel CLA 2017-02-01 05:29:38 EST
Thanks Ralf. Looks good to me, all Unit tests except FormColorsTests are green. FormColorsTests fails already before this patch.