<commit_before><commit_msg>..channel.widgets: adding tooltip class that shows under the component and has the look of a native tooltip on Windows 7.<commit_after>package org.csstudio.channel.widgets.util;

import org.eclipse.jface.window.DefaultToolTip;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.wb.swt.SWTResourceManager;

public class ToolTipHelp extends DefaultToolTip {
	
	private static Color[] windowsBackground =
			new Color[] {SWTResourceManager.getColor(255,255,255), SWTResourceManager.getColor(228,229,240)};
	private static int[] colorSteps = new int[] {100};
	
	private Control control;

	public ToolTipHelp(Control control) {
		super(control, NO_RECREATE, false);
		this.control = control;
	}
	
	@Override
	protected Composite createToolTipContentArea(Event event,
			Composite parent) {
		System.out.println("Creating for " + event);
		setShift(new Point(- event.x, control.getSize().y - event.y));
		CLabel label = (CLabel) super.createToolTipContentArea(event, parent);
		// The tooltip background on windows 7 does not match
		// Hack a better match for standard configuration
		if ("Windows 7".equals(System.getProperty("os.name"))) {
			label.setBackground(windowsBackground, colorSteps, true);
		}
		return label;
	}
}
{'fraction_non_alphanumeric': 0.11011699931176876, 'fraction_numerical': 0.016517549896765314, 'mean_word_length': 5.187234042553191, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3026679', 'n_tokens_mistral': 481, 'n_tokens_neox': 434, 'n_words': 112}