@Override
  public void apply(@NotNull Editor editor, @NotNull GroovySmartEnterProcessor processor, @NotNull PsiElement psiElement) {
    GrSynchronizedStatement synchronizedStatement = PsiTreeUtil.getParentOfType(psiElement, GrSynchronizedStatement.class);
    if (synchronizedStatement == null || synchronizedStatement.getBody() != null) return;

    if (!PsiTreeUtil.isAncestor(synchronizedStatement.getMonitor(), psiElement, false)) return;


    final Document doc = editor.getDocument();

    PsiElement eltToInsertAfter = synchronizedStatement.getRParenth();
    String text = "{\n}";
    if (eltToInsertAfter == null) {
      eltToInsertAfter = synchronizedStatement.getMonitor();
      text = "){\n}";
    }

    doc.insertString(eltToInsertAfter.getTextRange().getEndOffset(), text);
  }
@Override
  public void apply(@NotNull Editor editor, @NotNull GroovySmartEnterProcessor processor, @NotNull PsiElement psiElement)