String (@NotNull String actualText) { Document document = EditorFactory.getInstance().createDocument(actualText); ((DocumentImpl)document).stripTrailingSpaces(getProject()); actualText = document.getText(); return actualText; }