@Override
  public void processText(Project project,
                          Template template,
                          Document document,
                          RangeMarker templateRange,
                          Editor editor) {
    if (!template.isToReformat()) return;

    PsiDocumentManager.getInstance(project).commitDocument(document);
    PsiFile file = PsiUtilBase.getPsiFileInEditor(editor, project);
    if (!(file instanceof PsiJavaFile)) return;

    CharSequence text = document.getImmutableCharSequence();
    int prevChar = CharArrayUtil.shiftBackward(text, templateRange.getStartOffset() - 1, " \t");
    int nextChar = CharArrayUtil.shiftForward(text, templateRange.getEndOffset(), " \t");
    if (prevChar > 0 && text.charAt(prevChar) == '{' && nextChar < text.length() && text.charAt(nextChar) == '}') {
      PsiCodeBlock codeBlock = PsiTreeUtil.findElementOfClassAtOffset(file, prevChar, PsiCodeBlock.class, false);
      if (codeBlock != null && codeBlock.getTextRange().getStartOffset() == prevChar) {
        PsiJavaToken rBrace = codeBlock.getRBrace();
        if (rBrace != null && rBrace.getTextRange().getStartOffset() == nextChar) {
          CodeEditUtil.markToReformat(rBrace.getNode(), true);
        }
      }
    }
  }
@Override
  public void processText(Project project,
                          Template template,
                          Document document,
                          RangeMarker templateRange,
                          Editor editor)