* @param endParent
*/
private void updateSectionFoldingAnnotations2(IDocument doc, List<Header> headers,
Map<Annotation, Position> newAnnotations, int endParent) {
for (int i=0; i<headers.size(); i++) {
Header header = headers.get(i);
ProjectionAnnotation annotation = new ProjectionAnnotation();
try {
int line = header.getLineNumber();
int start = doc.getLineOffset(line);
int end = (i==headers.size()-1)? endParent
: doc.getLineOffset(headers.get(i+1).getLineNumber());
Position position = new Position(start, end-start);
newAnnotations.put(annotation, position);
// Recurse
List<Header> subHeaders = header.getSubHeaders();
if (subHeaders.size() > 0) {
updateSectionFoldingAnnotations2(doc, subHeaders, newAnnotations, end);
}
} catch (Exception ex) {
System.out.println(ex);