*/
protected void updateFoldingStructure(Collapsible[] newCollapsibles) {
for (Collapsible collapsible : newCollapsibles) {
if (m_CollapsibleElements.containsKey(collapsible)) {
// an existing element
ProjectionAnnotation annotation = m_CollapsibleElements
.get(collapsible);
Position oldPosition = getAnnotation()
.getPosition(annotation);
Position newPosition = getElementPosition(collapsible);
// did the position change?
if (oldPosition == null || !oldPosition.equals(newPosition)) {
getAnnotation().modifyAnnotationPosition(annotation,
newPosition);
}
} else {
// if a new element was found
ProjectionAnnotation annotation = new ProjectionAnnotation();
Position position = getElementPosition(collapsible);
getAnnotation().addAnnotation(annotation, position);
// add it to the list of known collapsible
m_CollapsibleElements.put(collapsible, annotation);
}
}
// find deleted elements
Set<Collapsible> collapsibleSet = m_CollapsibleElements.keySet();
Iterator<Collapsible> it = collapsibleSet.iterator();
ArrayList<Collapsible> deletedItems = new ArrayList<Collapsible>();
while (it.hasNext()) {
Collapsible collapsible = it.next();
ProjectionAnnotation annotation = m_CollapsibleElements.get(collapsible);
// if the element does not exist in the new list, remove it
boolean bFound=false;
for(int i=0;i<newCollapsibles.length;i++){
if (newCollapsibles[i].equals(collapsible)){
bFound=true;