void (Project project) { if (!pagesInDocument.isEmpty()) { pagesInDocument.clear(); symbolOffsetToEndOfPage.clear(); runAsWriteAction(project, () -> myDocument.deleteString(0, myDocument.getTextLength())); } }