void (PsiFile file, final PsiElement suppressionElement, String inspectionId, final int offset) { final Project project = file.getProject(); //final Document doc = PsiDocumentManager.getInstance(project).getDocument(file); final Document doc = file.getViewProvider().getDocument(); assert doc != null; if (suppressionElement != null) { final TextRange textRange = suppressionElement.getTextRange(); String text = suppressionElement.getText(); final String suppressionText = getSuppressionText(inspectionId, text); doc.replaceString(textRange.getStartOffset(), textRange.getEndOffset(), suppressionText); } else { final String suppressionText = getSuppressionText(inspectionId, null); doc.insertString(offset, suppressionText); CodeStyleManager.getInstance(project).adjustLineIndent(doc, offset + suppressionText.length()); UndoUtil.markPsiFileForUndo(file); } }