### Eclipse Workspace Patch 1.0 #P org.eclipse.ui.forms Index: src/org/eclipse/ui/internal/forms/widgets/FormImages.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.ui.forms/src/org/eclipse/ui/internal/forms/widgets/FormImages.java,v retrieving revision 1.3 diff -u -r1.3 FormImages.java --- src/org/eclipse/ui/internal/forms/widgets/FormImages.java 25 Jan 2008 16:54:46 -0000 1.3 +++ src/org/eclipse/ui/internal/forms/widgets/FormImages.java 10 Jun 2008 15:44:40 -0000 @@ -16,6 +16,7 @@ import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.GC; import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.widgets.Display; public class FormImages { @@ -35,22 +36,26 @@ private abstract class ImageIdentifier { Display fDisplay; - Color[] fColors; + RGB[] fRGBs; int fLength; ImageIdentifier(Display display, Color[] colors, int length) { fDisplay = display; - fColors = colors; + fRGBs = new RGB[colors.length]; + for (int i = 0; i < colors.length; i++) { + Color color = colors[i]; + fRGBs[i] = color == null ? null : color.getRGB(); + } fLength = length; } public boolean equals(Object obj) { if (obj instanceof ImageIdentifier) { ImageIdentifier id = (ImageIdentifier)obj; - if (id.fColors.length == fColors.length) { + if (id.fRGBs.length == fRGBs.length) { boolean result = id.fDisplay.equals(fDisplay) && id.fLength == fLength; - for (int i = 0; i < fColors.length && result; i++) { - result = result && id.fColors[i].equals(fColors[i]); + for (int i = 0; i < fRGBs.length && result; i++) { + result = result && id.fRGBs[i].equals(fRGBs[i]); } return result; } @@ -60,8 +65,8 @@ public int hashCode() { int hash = fDisplay.hashCode(); - for (int i = 0; i < fColors.length; i++) - hash = hash * 7 + fColors[i].hashCode(); + for (int i = 0; i < fRGBs.length; i++) + hash = hash * 7 + fRGBs[i].hashCode(); hash = hash * 7 + fLength; return hash; } @@ -97,14 +102,14 @@ } private class ComplexImageIdentifier extends ImageIdentifier { - Color fBg; + RGB fBgRGB; boolean fVertical; int[] fPercents; public ComplexImageIdentifier(Display display, Color[] colors, int length, int[] percents, boolean vertical, Color bg) { super(display, colors, length); - fBg = bg; + fBgRGB = bg == null ? null : bg.getRGB(); fVertical = vertical; fPercents = percents; } @@ -114,8 +119,8 @@ ComplexImageIdentifier id = (ComplexImageIdentifier) obj; if (super.equals(obj) && id.fVertical == fVertical && Arrays.equals(id.fPercents, fPercents)) { - if ((id.fBg == null && fBg == null) || - (id.fBg != null && id.fBg.equals(fBg))) + if ((id.fBgRGB == null && fBgRGB == null) || + (id.fBgRGB != null && id.fBgRGB.equals(fBgRGB))) return true; // if the only thing that isn't the same is the background color // still return true if it does not matter (percents add up to 100)