found.add(i.next());
//process all the annotations currently attached to the model
for (Iterator i = annotModel.getAnnotationIterator(); i.hasNext(); )
{
Annotation current = (Annotation)i.next();
//if we have a type we are not interested in, we will skip it
if (!annotationSupported(current))
continue;
if (!annotations.containsKey(current))
{
//new annotaiton
MarkerAnnotation toAdd = (MarkerAnnotation)current;
if (toAdd.getType().equals("org.eclipse.ui.workbench.texteditor.bookmark"))
{
XCDEBookmarkDetails details = buildBookmarkDetails(toAdd);
XCDEDocumentAnnotation a = buildXCDEAnnotation(annotModel.getPosition(current).offset, annotModel.getPosition(current).length, details);
annotations.put(current,a);
makeChange(new XCDEDocumentAnnotationStimulusAdd(parentRegister.getUsername(),a));
}
else if (toAdd.getType().equals("org.eclipse.ui.workbench.texteditor.task"))
{
XCDETaskDetails details = buildTaskDetails(toAdd);
XCDEDocumentAnnotation a = buildXCDEAnnotation(annotModel.getPosition(current).offset, annotModel.getPosition(current).length, details);
annotations.put(current,a);
makeChange(new XCDEDocumentAnnotationStimulusAdd(parentRegister.getUsername(),a));
}
}
else
{
//changed
MarkerAnnotation toChange = (MarkerAnnotation)current;
if (toChange.getType().equals("org.eclipse.ui.workbench.texteditor.bookmark"))
{
XCDEBookmarkDetails details = buildBookmarkDetails(toChange);
XCDEDocumentAnnotation a = buildXCDEAnnotation(annotModel.getPosition(current).offset, annotModel.getPosition(current).length, details);
if (!((XCDEDocumentAnnotation)annotations.get(current)).details.equals(details))
{
makeChange(new XCDEDocumentAnnotationStimulusChange(parentRegister.getUsername(),
(XCDEDocumentAnnotation)annotations.get(current),a));
}
annotations.put(current,a);
}
else if (toChange.getType().equals("org.eclipse.ui.workbench.texteditor.task"))
{
XCDETaskDetails details = buildTaskDetails(toChange);
XCDEDocumentAnnotation a = buildXCDEAnnotation(annotModel.getPosition(current).offset, annotModel.getPosition(current).length, details);
if (!((XCDEDocumentAnnotation)annotations.get(current)).details.equals(details))
{
makeChange(new XCDEDocumentAnnotationStimulusChange(parentRegister.getUsername(),
(XCDEDocumentAnnotation)annotations.get(current),a));
}
annotations.put(current,a);
}
found.remove(current);
}
}
for (Iterator i = found.iterator(); i.hasNext(); )
{
Annotation current = (Annotation)i.next();
// This check should be unnecessary, because we only store MarkerAnnotations in the annotations map.
//if (!(current instanceof MarkerAnnotation))
// continue;
MarkerAnnotation toDelete = (MarkerAnnotation)current;
if (toDelete.getType().equals("org.eclipse.ui.workbench.texteditor.bookmark"))