2323import org .eclipse .swt .graphics .Point ;
2424import org .eclipse .swt .graphics .RGBA ;
2525import org .eclipse .swt .widgets .Control ;
26- import org .eclipse .tracecompass .internal .tmf .ui .Messages ;
2726import org .eclipse .tracecompass .tmf .core .presentation .RGBAColor ;
28- import org .eclipse .tracecompass .tmf .core .timestamp .ITmfTimestamp ;
29- import org .eclipse .tracecompass .tmf .core .timestamp .TmfTimestamp ;
3027import org .eclipse .tracecompass .tmf .ui .viewers .TmfAbstractToolTipHandler ;
3128import org .eclipse .tracecompass .tmf .ui .viewers .TmfAbstractToolTipHandler .ToolTipString ;
3229import org .eclipse .tracecompass .tmf .ui .viewers .xychart .IAxis ;
3330import org .eclipse .tracecompass .tmf .ui .viewers .xychart .ITmfChartTimeProvider ;
3431import org .eclipse .tracecompass .tmf .ui .viewers .xychart .IXYSeries ;
3532import org .eclipse .tracecompass .tmf .ui .viewers .xychart .TmfBaseProvider ;
33+ import org .eclipse .tracecompass .tmf .ui .viewers .xychart .linechart .TmfCommonXAxisChartViewer ;
3634
3735/**
3836 * Displays a tooltip on line charts. For each series, it shows the y value at
@@ -81,10 +79,7 @@ protected int getHoveredIndex(List<IXYSeries> series, double xCoordinate) {
8179 return -1 ;
8280 }
8381 double [] xSeries = series .get (0 ).getXSeries ();
84- if (xSeries == null ) {
85- return -1 ;
86- }
87- if (xSeries .length == 0 ) {
82+ if ((xSeries == null ) || (xSeries .length == 0 )) {
8883 return -1 ;
8984 }
9085 int index = Arrays .binarySearch (xSeries , xCoordinate );
@@ -101,12 +96,7 @@ protected void addAdditionalTooltipItems(double xCoordinate, String seriesKey) {
10196 // Default: no-op
10297 }
10398
104- protected void addSeriesTooltipItem (
105- IXYSeries series ,
106- String key ,
107- int index ,
108- Format format ) {
109-
99+ protected void addSeriesTooltipItem (IXYSeries series , String key , int index , Format format ) {
110100 double [] ySeries = series .getYSeries ();
111101 if (ySeries == null || index < 0 || index >= ySeries .length ) {
112102 return ;
@@ -121,16 +111,13 @@ protected void addSeriesTooltipItem(
121111 }
122112 }
123113
124- protected String formatSeriesLabel (
125- IXYSeries series ,
126- String key ) {
127-
114+ protected String formatSeriesLabel (IXYSeries series , String key ) {
128115 String label = (key == null ) ? "" : key ; //$NON-NLS-1$
129116 Color color = series .getColor ();
130117 if (color != null ) {
131118 RGBA rgba = color .getRGBA ();
132119 RGBAColor rgbaColor = new RGBAColor (rgba .rgb .red , rgba .rgb .green , rgba .rgb .blue , rgba .alpha );
133- label = String .format (HTML_COLOR_TOOLTIP , rgbaColor , label );
120+ label = String .format (TmfCommonXLineChartTooltipProvider . HTML_COLOR_TOOLTIP , rgbaColor , label );
134121 }
135122 return label ;
136123 }
0 commit comments