@Override public void addAnnotation(Annotation annotation, Position position) { try { addAnnotation(annotation, position, true); } catch (BadLocationException e) { // ignore invalid position } }
@Override public void addAnnotation(Annotation annotation, Position position) { try { addAnnotation(annotation, position, true); } catch (BadLocationException e) { // ignore invalid position } }
/** * Replaces the given annotations in this model and if advised fires a * model change event. * * @param annotationsToRemove the annotations to be removed * @param annotationsToAdd the annotations to be added * @param fireModelChanged <code>true</code> if a model change event * should be fired, <code>false</code> otherwise * @throws BadLocationException in case an annotation should be added at an * invalid position * @since 3.0 */ protected void replaceAnnotations(Annotation[] annotationsToRemove, Map<? extends Annotation, ? extends Position> annotationsToAdd, boolean fireModelChanged) throws BadLocationException { if (annotationsToRemove != null) { for (int i= 0, length= annotationsToRemove.length; i < length; i++) removeAnnotation(annotationsToRemove[i], false); } if (annotationsToAdd != null) { Iterator<? extends Entry<? extends Annotation, ? extends Position>> iter= annotationsToAdd.entrySet().iterator(); while (iter.hasNext()) { Map.Entry<? extends Annotation, ? extends Position> mapEntry= iter.next(); Annotation annotation= mapEntry.getKey(); Position position= mapEntry.getValue(); addAnnotation(annotation, position, false); } } if (fireModelChanged) fireModelChanged(); }
/** * Replaces the given annotations in this model and if advised fires a * model change event. * * @param annotationsToRemove the annotations to be removed * @param annotationsToAdd the annotations to be added * @param fireModelChanged <code>true</code> if a model change event * should be fired, <code>false</code> otherwise * @throws BadLocationException in case an annotation should be added at an * invalid position * @since 3.0 */ protected void replaceAnnotations(Annotation[] annotationsToRemove, Map<? extends Annotation, ? extends Position> annotationsToAdd, boolean fireModelChanged) throws BadLocationException { if (annotationsToRemove != null) { for (Annotation element : annotationsToRemove) removeAnnotation(element, false); } if (annotationsToAdd != null) { Iterator<? extends Entry<? extends Annotation, ? extends Position>> iter= annotationsToAdd.entrySet().iterator(); while (iter.hasNext()) { Map.Entry<? extends Annotation, ? extends Position> mapEntry= iter.next(); Annotation annotation= mapEntry.getKey(); Position position= mapEntry.getValue(); addAnnotation(annotation, position, false); } } if (fireModelChanged) fireModelChanged(); }
addAnnotation(annotation, position, fireModelChanged); } catch (BadLocationException x) {
addAnnotation(annotation, position, fireModelChanged); } catch (BadLocationException x) {