Bug 313211 [CSS] Optimizing Linear Gradients
bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/GradientBackgroundListener.java
import org.eclipse.e4.ui.css.swt.helpers.CSSSWTColorHelper;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.PaletteData;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
public class GradientBackgroundListener implements Listener {
	private Gradient grad;
	private final Control control;
	private static Map<Control, GradientBackgroundListener> handlers = new HashMap<Control, GradientBackgroundListener>();
	private static boolean isRadialSupported;
	static {
		
		
		
		try {
			Class<?> radialGradientPaintClass = Class
					.forName("java.awt.RadialGradientPaint"); 
			isRadialSupported = true;
		} catch (Exception e) {
			System.err
					.println("Warning - radial gradients are only supported in Java 6 and higher, using linear gradient instead"); 
			isRadialSupported = false;