org.eclipse.jface.viewers.IToolTipProvider Java Examples

The following examples show how to use org.eclipse.jface.viewers.IToolTipProvider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TimelineViewer.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
private ITimelineEvent toEvent(Object element) {
	if (element instanceof ITimelineEvent)
		return (ITimelineEvent) element;

	final Timing timings = getLabelProvider().getTimings(element);
	if (timings != null) {
		final ITimelineEvent event = ITimelineFactory.eINSTANCE.createTimelineEvent();
		event.setStartTimestamp((long) timings.getTimestamp());
		event.setDuration((long) timings.getDuration());

		final ITimelineLabelProvider labelProvider = getLabelProvider();
		event.setTitle(labelProvider.getText(element));

		if (labelProvider instanceof IToolTipProvider)
			event.setMessage(((IToolTipProvider) labelProvider).getToolTipText(element));

		if (labelProvider instanceof IColorProvider) {
			final Color color = ((IColorProvider) labelProvider).getForeground(element);
			if (color != null)
				event.setColorCode(toColorCode(color));
		}

		return event;
	}

	return null;
}