String toolTipMessage = null;
int toolTipStyle = SWT.BALLOON;
// Otherwise get values for a scenario
Font italic2 = italic;
ScenarioResultsElement scenarioResultsElement = (ScenarioResultsElement) scenarios[col-1];
if (milestoneName != null || (!fingerprints && scenarioResultsElement.hasSummary())) {
italic2 = this.boldItalicFont;
item.setFont(col, this.boldFont);
}
// Otherwise get values for a scenario
double[] values = (double[]) line.get(col);
if (values == ComponentResults.NO_BUILD_RESULTS) {
item.setText(col, "Missing");
item.setForeground(col, GRAY);
item.setFont(col, italic2);
} else if (values == ComponentResults.INVALID_RESULTS) {
item.setText(col, "Invalid");
item.setForeground(col, RED);
item.setFont(col, italic2);
} else {
// Get values array
double buildValue = values[ComponentResults.BUILD_VALUE_INDEX];
double baselineValue = values[ComponentResults.BASELINE_VALUE_INDEX];
double delta = values[ComponentResults.DELTA_VALUE_INDEX];
double error = values[ComponentResults.DELTA_ERROR_INDEX];
// Set text with delta value
item.setText(col, PERCENTAGE_FORMAT.format(delta));
// Compute the tooltip to display on the cell
if (error > 0.03) {
// error is over the 3% threshold
item.setImage(col, ResultsElement.WARN_IMAGE);
item.setForeground(col, this.darkyellow);
if (toolTipText == null) {
toolTipText = "";
} else {
toolTipText += ", ";
}
toolTipText += "May be not reliable";
if (toolTipMessage == null) {
toolTipMessage = "";
} else {
toolTipMessage += ".\n";
}
toolTipMessage += "The error on this result is "+PERCENTAGE_FORMAT.format(error)+", hence it may be not reliable";
toolTipStyle |= SWT.ICON_WARNING;
}
if (delta < -0.1) {
// delta < -10%: failure shown by an red-cross icon + text in red
item.setImage(col, ResultsElement.ERROR_IMAGE);
item.setForeground(col, RED);
} else if (delta < -0.05) {
// negative delta over 5% shown in red
item.setForeground(col, RED);
} else if (delta < 0) {
// negative delta shown in magenta
item.setForeground(col, MAGENTA);
} else if (delta > 0.2) {
// positive delta over 20% shown in green
item.setForeground(col, DARK_GREEN);
} else if (delta > 0.1) {
// positive delta between 10% and 20% shown in blue
item.setForeground(col, BLUE);
}
// Moderate the status if the build value or the difference is small
if (delta < 0) {
double diff = Math.abs(baselineValue - buildValue);
if (buildValue < 100 || diff < 100) {
if (toolTipText == null) {
toolTipText = "";
} else {
toolTipText += ", ";
}
toolTipText += "Small value";
if (toolTipMessage == null) {
toolTipMessage = "";
} else {
toolTipMessage += ".\n";
}
if (buildValue < 100) {
toolTipMessage += "This test has a small value ("+buildValue+"ms)";
} else {
toolTipMessage += "This test variation has a small value ("+diff+"ms)";
}
toolTipMessage += ", hence it may not be necessary to spend time on fixing this possible regression";
// set the text in italic
item.setFont(col, italic2);
toolTipStyle |= SWT.ICON_INFORMATION;
}
}
// Add information in tooltip when history shows big variation
if (deviations[col-1] < 0) {
ConfigResultsElement configResultsElement = (ConfigResultsElement) scenarioResultsElement.getResultsElement(this.configName);
double[] stats = configResultsElement.getStatistics();
deviations[col-1] = stats[3];
}
if (deviations[col-1] > 20) {
// deviation is over 20% over the entire history
if (toolTipText == null) {
toolTipText = "";
} else {
toolTipText += ", ";
}
toolTipText += "History shows erratic values";
if (toolTipMessage == null) {
toolTipMessage = "";
} else {
toolTipMessage += ".\n";
}
toolTipMessage += "The results history shows that the variation of its delta is over 20% ("+PERCENTAGE_FORMAT.format(deviations[col-1])+"), hence its result is surely not reliable";
// set the text in italic
item.setFont(col, italic2);
toolTipStyle |= SWT.ICON_INFORMATION;
} else if (deviations[col-1] > 10) { // moderate the status when the test
// deviation is between 10% and 20% over the entire history
if (toolTipText == null) {
toolTipText = "";
} else {
toolTipText += ", ";
}
toolTipText += "History shows unstable values";
if (toolTipMessage == null) {
toolTipMessage = "";
} else {
toolTipMessage += ".\n";
}
toolTipMessage += "The results history shows that the variation of its delta is between 10% and 20% ("+PERCENTAGE_FORMAT.format(deviations[col-1])+"), hence its result may not be really reliable";
// set the text in italic
item.setFont(col, italic2);
if (toolTipStyle == SWT.BALLOON && delta >= -0.1) {
toolTipStyle |= SWT.ICON_INFORMATION;
} else {
// reduce icon severity from error to warning
toolTipStyle |= SWT.ICON_WARNING;
}
}
}
// Set tooltip
if (toolTipText != null) {
createToolTip(toolTipText, toolTipMessage, toolTipStyle, new Point(col, row));
}
// Baseline name
ConfigResultsElement configResultsElement = (ConfigResultsElement) scenarioResultsElement.getResultsElement(this.configName);
if (configResultsElement != null) {
String configBaselineName = configResultsElement.getBaselineBuildName(buildName);
if (baselineName == null) {
baselineName = configBaselineName;
} else if (baselineName.indexOf(configBaselineName) < 0) {