IDocument document = viewer.getDocument();
try
{
ProjectionAnnotationModel projectionAnnotationModel = ( ProjectionAnnotationModel ) editor
.getAdapter( ProjectionAnnotationModel.class );
if ( projectionAnnotationModel == null )
return;
// create folding regions of current LDIF model; mark comments
// and
// folded lines as collapsed
Map positionToAnnotationMap = createFoldingRegions( editor.getLdifModel(), document );
// compare with current annotation model (--> toAdd, toDelete)
List annotationsToDeleteList = new ArrayList();
Map annotationsToAddMap = new HashMap();
this.computeDifferences( projectionAnnotationModel, positionToAnnotationMap, annotationsToDeleteList,
annotationsToAddMap );
Annotation[] annotationsToDelete = ( Annotation[] ) annotationsToDeleteList
.toArray( new Annotation[annotationsToDeleteList.size()] );
// update annotation model
if ( !annotationsToDeleteList.isEmpty() || !annotationsToAddMap.isEmpty() )
{
projectionAnnotationModel.modifyAnnotations( annotationsToDelete, annotationsToAddMap,
new Annotation[0] );
}
}
catch ( BadLocationException e )