public static boolean insertCloseTagIfNeeded(Editor editor, PsiFile file, Project project) {
final Document document = editor.getDocument();
final PsiDocumentManager documentManager = PsiDocumentManager.getInstance(project);
int offset = editor.getCaretModel().getOffset();
documentManager.commitDocument(document);
char charAtOffset = DocumentUtils.getCharAt(document, offset);
if (charAtOffset != '>') {
EditorModificationUtil.insertStringAtCaret(editor, ">", true, 0);
}