void (@NotNull Environment env) { int offset = generateDocOffset(env, null); String toInsert = env.generateValue(Generator.stringsOf(Generator.asciiPrintableChars()), "Insert '%s' at " + offset); WriteCommandAction.runWriteCommandAction(getProject(), () -> getDocument().insertString(offset, toInsert)); }