same = (gradientColors[i] == colors[i]) || ((gradientColors[i] == null) && (colors[i] == background)) || ((gradientColors[i] == background) && (colors[i] == null));
if (gradientColors[i] == null) { same = colors[i] == null; } else { same = gradientColors[i].equals(colors[i]); }
public void setSelectionBackground(Color[] colors, int[] percents) {	checkWidget();	if (colors != null) {		if (percents == null || percents.length != colors.length - 1) {			SWT.error(SWT.ERROR_INVALID_ARGUMENT);		}		if (getDisplay().getDepth() < 15) {			// Don't use gradients on low color displays			colors = new Color[] { colors[0] };			percents = new int[] { };		}		for (int i = 0; i < percents.length; i++) {			if (percents[i] < 0 || percents[i] > 100) {				SWT.error(SWT.ERROR_INVALID_ARGUMENT);			}			if (i > 0 && percents[i] < percents[i-1]) {				SWT.error(SWT.ERROR_INVALID_ARGUMENT);			}		}	}		// Are these settings the same as before?	final Color background = getBackground();	if (backgroundImage == null) {		if ((gradientColors != null) && (colors != null) && 			(gradientColors.length == colors.length)) {			boolean same = false;			for (int i = 0; i < gradientColors.length; i++) {				same = (gradientColors[i] == colors[i]) ||					((gradientColors[i] == null) && (colors[i] == background)) ||					((gradientColors[i] == background) && (colors[i] == null));				if (!same) break;			}			if (same) {				for (int i = 0; i < gradientPercents.length; i++) {					same = gradientPercents[i] == percents[i];					if (!same) break;				}			}			if (same) return;		}	} else {		backgroundImage = null;	}	// Store the new settings	if (colors == null) {		gradientColors = null;		gradientPercents = null;		closeBar.setBackground(background);	} else {		gradientColors = new Color[colors.length];		for (int i = 0; i < colors.length; ++i)			gradientColors[i] = (colors[i] != null) ? colors[i] : background;		gradientPercents = new int[percents.length];		for (int i = 0; i < percents.length; ++i)			gradientPercents[i] = percents[i];		if (getDisplay().getDepth() < 15) closeBar.setBackground(background);		else closeBar.setBackground(gradientColors[gradientColors.length - 1]);	}	// Refresh with the new settings	if (selectedIndex > -1) redrawTabArea(selectedIndex);}