protected void measure(Event event, Object element) {
}
@Override
protected void paint(Event event, Object element) {
final ICoverageNode coverage = CoverageTools.getCoverageInfo(element);
if (coverage != null) {
final ICounter counter = coverage.getCounter(settings.getCounters());
RedGreenBar.draw(event, column1.getColumn().getWidth(), counter,
maxTotalCache.getMaxTotal(element));
}
}
});
sorter.addColumn(column1, COLUMN_RATIO);
final TreeViewerColumn column2 = new TreeViewerColumn(viewer, SWT.RIGHT);
column2.setLabelProvider(new CellLabelProvider() {
@Override
public void update(ViewerCell cell) {
if (cell.getElement() == LOADING_ELEMENT) {
cell.setText(""); //$NON-NLS-1$
} else {
cell.setText(cellTextConverter.getCovered(cell.getElement()));
}
}
});
sorter.addColumn(column2, COLUMN_COVERED);
final TreeViewerColumn column3 = new TreeViewerColumn(viewer, SWT.RIGHT);
column3.setLabelProvider(new CellLabelProvider() {
@Override
public void update(ViewerCell cell) {
if (cell.getElement() == LOADING_ELEMENT) {
cell.setText(""); //$NON-NLS-1$
} else {
cell.setText(cellTextConverter.getMissed(cell.getElement()));
}
}
});
sorter.addColumn(column3, COLUMN_MISSED);
final TreeViewerColumn column4 = new TreeViewerColumn(viewer, SWT.RIGHT);
column4.setLabelProvider(new CellLabelProvider() {
@Override
public void update(ViewerCell cell) {
if (cell.getElement() == LOADING_ELEMENT) {
cell.setText(""); //$NON-NLS-1$
} else {
cell.setText(cellTextConverter.getTotal(cell.getElement()));
}
}
});
sorter.addColumn(column4, COLUMN_TOTAL);
viewer.addFilter(new ViewerFilter() {
public boolean select(Viewer viewer, Object parentElement, Object element) {
if (element == LOADING_ELEMENT) {
return true;
} else {
final ICoverageNode c = CoverageTools.getCoverageInfo(element);
if (c == null) {
return false;
}
final ICounter instructions = c.getInstructionCounter();
if (instructions.getTotalCount() == 0) {
return false;
}
if (settings.getHideUnusedElements()
&& instructions.getCoveredCount() == 0) {