timing.ui: no tooltip when no data is hovered The binary search here will return a negative number if and only if there is no value found. If there is no value found, that means the mouse is hovering a section of the graph where there is no data. In that case, no tooltip should be displayed. To test that, the user should use the Density Viewer of any analysis and hover on the leftmost side of the graph. It might be a quite small area, but zooming on the leftmost side of the view can make that error appear often. The previous behaviour ends up throwing an error, because if the binary search returns -1, the calculated index is -1 which is out of bounds. Signed-off-by: Arnaud Fiorini <fiorini.arnaud@gmail.com> Change-Id: Ic7f312babc31367af3182ff14f235e17e5205b51 Reviewed-on: https://git.eclipse.org/r/c/tracecompass/org.eclipse.tracecompass/+/203431 Tested-by: Trace Compass Bot <tracecompass-bot@eclipse.org> Tested-by: Marco Miller <marco.miller@ericsson.com> Reviewed-by: Marco Miller <marco.miller@ericsson.com>
diff --git a/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/internal/analysis/timing/ui/views/segmentstore/density2/SimpleTooltipProvider.java b/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/internal/analysis/timing/ui/views/segmentstore/density2/SimpleTooltipProvider.java index 37d5c31..edf7ef2 100644 --- a/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/internal/analysis/timing/ui/views/segmentstore/density2/SimpleTooltipProvider.java +++ b/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/internal/analysis/timing/ui/views/segmentstore/density2/SimpleTooltipProvider.java
@@ -64,7 +64,7 @@ double coords = xAxis.getDataCoordinate(event.x); int index = Arrays.binarySearch(xValues, coords); if (index < 0) { - index = -index - 2; + return; } double[] ySeries = ySeriesProvider.getYSeries(); long y = Math.round(ySeries[index]); @@ -116,4 +116,4 @@ public SimpleTooltipProvider(AbstractSegmentStoreDensityViewer densityViewer) { super(densityViewer); } -} \ No newline at end of file +}