Annotation[] oldAnnotations = fAnnotations
.toArray(new Annotation[fAnnotations.size()]);
Map<Annotation, Position> newAnnotations = new HashMap<Annotation, Position>(
fMessages.size());
for (PositionedMessage pm : fMessages) {
Annotation anno = new Annotation(fAnnotationType, false,
pm.message);
newAnnotations.put(anno, pm.pos);
fAnnotations.add(anno);
}
modelExt.replaceAnnotations(oldAnnotations, newAnnotations);
} else {
for (Iterator i = model.getAnnotationIterator(); i.hasNext();) {
Annotation a = (Annotation) i.next();
if (a.getType().equals(fAnnotationType)) {
model.removeAnnotation(a);
}
}
for (PositionedMessage pm : fMessages) {
Annotation annotation = new Annotation(fAnnotationType, false,
pm.message);
model.addAnnotation(annotation, pm.pos);
fAnnotations.add(annotation);
}