@Override
  public void apply(@NotNull Editor editor, @NotNull GroovySmartEnterProcessor processor, @NotNull PsiElement psiElement) {
    if (!(psiElement instanceof GrMethod method)) return;
    final PsiClass aClass = method.getContainingClass();
    if (aClass != null && aClass.isInterface() || method.hasModifierProperty(PsiModifier.ABSTRACT)) return;
    final GrCodeBlock body = method.getBlock();
    final Document doc = editor.getDocument();
    if (body != null) {
      // See IDEADEV-1093. This is quite hacky heuristic but it seem to be best we can do.
      String bodyText = body.getText();
      if (StringUtil.startsWithChar(bodyText, '{')) {
        final GrStatement[] statements = body.getStatements();
        if (statements.length > 0) {
//          [todo]
//          if (statements[0] instanceof PsiDeclarationStatement) {
//            if (PsiTreeUtil.getDeepestLast(statements[0]) instanceof PsiErrorElement) {
//              if (method.getContainingClass().getRBrace() == null) {
//                doc.insertString(body.getTextRange().getStartOffset() + 1, "\n}");
//              }
//            }
//          }
        }
      }
      return;
    }
    int endOffset = method.getTextRange().getEndOffset();
    if (StringUtil.endsWithChar(method.getText(), ';')) {
      doc.deleteString(endOffset - 1, endOffset);
      endOffset--;
    }
    doc.insertString(endOffset, "{\n}");
  }
@Override
  public void apply(@NotNull Editor editor, @NotNull GroovySmartEnterProcessor processor, @NotNull PsiElement psiElement)