String name = annotation.getName(); String value = annotation.getValue(); int start = annotation.getRange().getStart();
/** * Updates an existing shadow blip. * * @param shadowBlip the blip that is shadowing. * @param blipToShadow the blip being shadowed. */ private void updateShadowBlip(Blip shadowBlip, Blip blipToShadow) { Preconditions.checkNotNull(shadowBlip, "Shadow blip can't be null"); Preconditions.checkNotNull(blipToShadow, "Blip to shadow can't be null"); shadowBlip.all().replace(blipToShadow.getContent()); for (Annotation annotation : blipToShadow.getAnnotations()) { if (annotation.getName().equals(ECHOEY_ANNOTATION)) { continue; } shadowBlip.range(annotation.getRange().getStart(), annotation.getRange().getEnd()).annotate( annotation.getName(), annotation.getValue()); } shadowBlip.all().annotate(ECHOEY_ANNOTATION, blipToShadow.getBlipId()); shadowBlipMap.put(blipToShadow.getBlipId(), shadowBlip.getBlipId()); }
this.annotations.add(annotation.getName(), annotation.getValue(), annotation.getRange().getStart(), annotation.getRange().getEnd());
case ANNOTATE: Annotation annotation = Annotation.class.cast(next); blip.getAnnotations().add(annotation.getName(), annotation.getValue(), start, end); break; case CLEAR_ANNOTATION: values.add(Annotation.class.cast(item).getValue()); annotationName = Annotation.class.cast(arguments[0]).getName(); break; case CLEAR_ANNOTATION:
for (Annotation annotation : blip.getAnnotations()) { Range range = annotation.getRange(); annotations.add(new Annotation(annotation.getName(), annotation.getValue(), range.getStart(), range.getEnd()));
/** * Copies the content of the source blip into the target blip. * * @param fromBlip the source blip. * @param toBlip the target blip. */ public static void copyBlipContents(Blip fromBlip, Blip toBlip) { for (BlipContent blipContent: fromBlip.all().values()) { toBlip.append(blipContent); } for (Annotation annotation : fromBlip.getAnnotations()) { Range range = annotation.getRange(); toBlip.range(range.getStart() + 1, range.getEnd() + 1).annotate(annotation.getName(), annotation.getValue()); } }