void (@NotNull Editor editor, @NotNull GroovySmartEnterProcessor processor, @NotNull PsiElement psiElement) { GrForStatement forStatement = PsiTreeUtil.getParentOfType(psiElement, GrForStatement.class); if (forStatement == null) return; final Document doc = editor.getDocument(); PsiElement body = forStatement.getBody(); if (body instanceof GrBlockStatement) return; if (body != null && startLine(doc, body) == startLine(doc, forStatement)) return; PsiElement eltToInsertAfter = forStatement.getRParenth(); String text = "{}"; if (eltToInsertAfter == null) { eltToInsertAfter = forStatement; text = "){}"; } doc.insertString(eltToInsertAfter.getTextRange().getEndOffset(), text); }