* Based on the table configuration and defaults lets update the label provider for the column
*/
protected void configureLabelProvider(ViewerColumn viewerColumn, ColumnConfiguration config, CellLabelProvider labelProvider) {
Class<?> returnType = Objects.getReturnType(labelProvider);
String style = config.getLabelProviderStyle();
FunctionColumnLabelProvider flp = null;
if (labelProvider instanceof FunctionColumnLabelProvider) {
flp = (FunctionColumnLabelProvider) labelProvider;
returnType = flp.getReturnType();
}
if (viewerColumn != null) {
CellLabelProvider provider = config.getLabelProvider();
if (provider != null) {
viewerColumn.setLabelProvider(provider);
} else {
if (style != null && style.equals("timeThenDate")) {
if (flp != null) {
viewerColumn.setLabelProvider(new TimeThenDateFunctionLabelProvider(flp.getFunction()));
} else {
viewerColumn.setLabelProvider(new TimeThenDateLabelProvider());
}
} else if (style != null && style.equals("longTimestampAsTimeThenDate")) {
viewerColumn.setLabelProvider(new LongTimestampAsTimeThenDateLabelProvider());
} else if (Objects.isNumberType(returnType)) {
if (style == null || !style.equals("plain")) {
viewerColumn.setLabelProvider(new ChartLabelProvider(labelProvider, getViewer()));
}
} else if (Objects.equal(style, "image") && flp != null) {
viewerColumn.setLabelProvider(new ImageLabelProvider(flp.getFunction()));
}
}
}
}