if (!waveXml.isEmpty()) {
instrumentor.record(Action.CLIPBOARD_PASTE_FROM_WAVE);
// initialise the XML:
Builder builder = at(pos);
XmlStringBuilder createdFromXmlString =
XmlStringBuilder.createFromXmlStringWithContraints(waveXml,
PermittedCharacters.BLIP_TEXT);
// Strip annotations based on behaviour:
StringMap<String> modified = annotationLogic.stripKeys(
destDoc, pos, cursorBias, ContentType.RICH_TEXT, builder);
double startTime = Duration.currentTimeMillis();
// apply xml change
MutableDocumentImpl.appendXmlToBuilder(createdFromXmlString, builder);
double timeTaken = Duration.currentTimeMillis() - startTime;
LOG.trace().log("time taken: " + timeTaken);
// handle the end of annotations
annotationLogic.unstripKeys(builder, modified.keySet(), CollectionUtils.createStringSet());
builder.finish();
Nindo nindo = builder.build();
try {
validator.maybeThrowOperationExceptionFor(nindo);
int locationAfter = destDoc.getLocation(insertAt) + createdFromXmlString.getLength();
destOperationSequencer.begin();
destOperationSequencer.consume(nindo);
destOperationSequencer.end();
aggressiveSelectionHelper.setCaret(locationAfter);