@Override
  public void apply(@NotNull Editor editor, @NotNull GroovySmartEnterProcessor processor, @NotNull PsiElement psiElement) {
    if (psiElement instanceof GrParameterList && psiElement.getParent() instanceof GrMethod) {
      PsiElement rParenth = ((GrParameterList)psiElement).getRParen();
      // TODO ends with comma
      if (rParenth == null || !")".equals(rParenth.getText())) {
        GrParameterList list = (GrParameterList)psiElement;
        final GrParameter[] params = list.getParameters();
        int offset;
        if (params.length == 0) {
          offset = list.getTextRange().getStartOffset() + 1;
        }
        else {
          offset = params[params.length - 1].getTextRange().getEndOffset();
        }
        editor.getDocument().insertString(offset, ")");
      }
    }
  }
@Override
  public void apply(@NotNull Editor editor, @NotNull GroovySmartEnterProcessor processor, @NotNull PsiElement psiElement)