private static void wrapQualifiedIntoMethodCall(@NotNull InsertionContext context, @NotNull String methodQualifiedName) {
    PsiFile file = context.getFile();
    PsiReferenceExpression ref =
      PsiTreeUtil.findElementOfClassAtOffset(file, context.getStartOffset(), PsiReferenceExpression.class, false);
    if (ref != null) {
      PsiElement qualifier = ref.getQualifier();
      if (qualifier != null) {
        TextRange range = qualifier.getTextRange();
        int startOffset = range.getStartOffset();

        String callSpace = getSpace(CodeStyle.getLanguageSettings(file).SPACE_WITHIN_METHOD_CALL_PARENTHESES);
        context.getDocument().insertString(range.getEndOffset(), callSpace + ")");
        context.getDocument().insertString(startOffset, methodQualifiedName + "(" + callSpace);

        context.commitDocument();
        Project project = context.getProject();
        JavaCodeStyleManager.getInstance(project).shortenClassReferences(
          file, startOffset, startOffset + methodQualifiedName.length());
        PsiDocumentManager.getInstance(project).doPostponedOperationsAndUnblockDocument(context.getDocument());
      }
    }
  }
private static void wrapQualifiedIntoMethodCall(@NotNull InsertionContext context, @NotNull String methodQualifiedName)