/** * Modifies the annotation model. * * @param deletions the list of deleted annotations * @param additions the set of annotations to add together with their associated position * @param modifications the list of modified annotations */ public void modifyAnnotations(Annotation[] deletions, Map<? extends Annotation, ? extends Position> additions, Annotation[] modifications) { try { replaceAnnotations(deletions, additions, false); if (modifications != null) { for (int i= 0; i < modifications.length; i++) modifyAnnotation(modifications[i], false); } } catch (BadLocationException x) { } fireModelChanged(); } }
/** * Modifies the annotation model. * * @param deletions the list of deleted annotations * @param additions the set of annotations to add together with their associated position * @param modifications the list of modified annotations */ public void modifyAnnotations(Annotation[] deletions, Map<? extends Annotation, ? extends Position> additions, Annotation[] modifications) { try { replaceAnnotations(deletions, additions, false); if (modifications != null) { for (int i= 0; i < modifications.length; i++) modifyAnnotation(modifications[i], false); } } catch (BadLocationException x) { } fireModelChanged(); } }
/** * Collapses all annotations that overlap with the given range and are collapsed. * * @param offset the range offset * @param length the range length * @return <code>true</code> if any annotation has been collapse, <code>false</code> * otherwise * @since 3.2 */ public boolean collapseAll(int offset, int length) { boolean collapsing= false; Iterator<Annotation> iterator= getAnnotationIterator(); while (iterator.hasNext()) { ProjectionAnnotation annotation= (ProjectionAnnotation) iterator.next(); if (!annotation.isCollapsed()) { Position position= getPosition(annotation); if (position != null && position.overlapsWith(offset, length) /* || is a delete at the boundary */ ) { annotation.markCollapsed(); modifyAnnotation(annotation, false); collapsing= true; } } } if (collapsing) fireModelChanged(); return collapsing; }
/** * Expands all annotations that overlap with the given range and are collapsed. Fires a model change event if * requested. * * @param offset the offset of the range * @param length the length of the range * @param fireModelChanged <code>true</code> if a model change event * should be fired, <code>false</code> otherwise * @return <code>true</code> if any annotation has been expanded, <code>false</code> otherwise */ protected boolean expandAll(int offset, int length, boolean fireModelChanged) { boolean expanding= false; Iterator<Annotation> iterator= getAnnotationIterator(); while (iterator.hasNext()) { ProjectionAnnotation annotation= (ProjectionAnnotation) iterator.next(); if (annotation.isCollapsed()) { Position position= getPosition(annotation); if (position != null && position.overlapsWith(offset, length) /* || is a delete at the boundary */ ) { annotation.markExpanded(); modifyAnnotation(annotation, false); expanding= true; } } } if (expanding && fireModelChanged) fireModelChanged(); return expanding; }
/** * Collapses all annotations that overlap with the given range and are collapsed. * * @param offset the range offset * @param length the range length * @return <code>true</code> if any annotation has been collapse, <code>false</code> * otherwise * @since 3.2 */ public boolean collapseAll(int offset, int length) { boolean collapsing= false; Iterator<Annotation> iterator= getAnnotationIterator(); while (iterator.hasNext()) { ProjectionAnnotation annotation= (ProjectionAnnotation) iterator.next(); if (!annotation.isCollapsed()) { Position position= getPosition(annotation); if (position != null && position.overlapsWith(offset, length) /* || is a delete at the boundary */ ) { annotation.markCollapsed(); modifyAnnotation(annotation, false); collapsing= true; } } } if (collapsing) fireModelChanged(); return collapsing; }
/** * Expands all annotations that overlap with the given range and are collapsed. Fires a model change event if * requested. * * @param offset the offset of the range * @param length the length of the range * @param fireModelChanged <code>true</code> if a model change event * should be fired, <code>false</code> otherwise * @return <code>true</code> if any annotation has been expanded, <code>false</code> otherwise */ protected boolean expandAll(int offset, int length, boolean fireModelChanged) { boolean expanding= false; Iterator<Annotation> iterator= getAnnotationIterator(); while (iterator.hasNext()) { ProjectionAnnotation annotation= (ProjectionAnnotation) iterator.next(); if (annotation.isCollapsed()) { Position position= getPosition(annotation); if (position != null && position.overlapsWith(offset, length) /* || is a delete at the boundary */ ) { annotation.markExpanded(); modifyAnnotation(annotation, false); expanding= true; } } } if (expanding && fireModelChanged) fireModelChanged(); return expanding; }