}
annotations.clear();
}
protected void createAnnotations(ILineCoverage linecoverage) {
AnnotationModelEvent event = new AnnotationModelEvent(this);
clear(event);
int firstline = linecoverage.getFirstLine();
int lastline = linecoverage.getLastLine();
int offset = linecoverage.getOffset();
byte[] coverage = linecoverage.getCoverage();
try {
for (int l = firstline ; l <= lastline; l++) {
int status = coverage[l - offset];
if (status != ILineCoverage.NO_CODE) {
IRegion region = document.getLineInformation(l - 1);
int docoffset = region.getOffset();
int doclength = region.getLength();
// Extend annotation for subsequent lines with same status:
while (l < lastline && coverage[l + 1 - offset] == status) {
l++;
region = document.getLineInformation(l - 1);
doclength = region.getOffset() - docoffset + region.getLength();
}
CoverageAnnotation ca = new CoverageAnnotation(docoffset, doclength, status);
annotations.add(ca);
event.annotationAdded(ca);
}
}
} catch (BadLocationException ex) {
EclEmmaUIPlugin.log(ex);
}