void (@NotNull InsertionContext context) { final Document document = context.getDocument(); final PsiFile file = context.getFile(); final PsiMethod method = getObject(); final LookupElement[] allItems = context.getElements(); ThreeState hasParams = method.getParameterList().isEmpty() ? ThreeState.NO : MethodParenthesesHandler.overloadsHaveParameters(allItems, method); if (method.isConstructor()) { PsiClass aClass = method.getContainingClass(); if (aClass != null && aClass.getTypeParameters().length > 0) { document.insertString(context.getTailOffset(), "<>"); } } JavaCompletionUtil.insertParentheses(context, this, false, hasParams, false); final int offset = context.getStartOffset(); final OffsetKey refStart = context.trackOffset(offset, true); beforeHandle(context); if (myNeedExplicitTypeParameters) { qualifyMethodCall(file, context.getOffset(refStart), document); insertExplicitTypeParameters(context, refStart); } else if (myHelper != null) { context.commitDocument(); importOrQualify(document, file, method, context.getOffset(refStart)); } PsiCallExpression methodCall = findCallAtOffset(context, context.getOffset(refStart)); // make sure this is the method call we've just added, not the enclosing one if (methodCall != null) { PsiElement completedElement = methodCall instanceof PsiMethodCallExpression ? ((PsiMethodCallExpression)methodCall).getMethodExpression().getReferenceNameElement() : null; TextRange completedElementRange = completedElement == null ? null : completedElement.getTextRange(); if (completedElementRange == null || completedElementRange.getStartOffset() != context.getOffset(refStart)) { methodCall = null; } } if (methodCall != null) { CompletionMemory.registerChosenMethod(method, methodCall); handleNegation(context, document, methodCall); } afterHandle(context, methodCall); if (canStartArgumentLiveTemplate()) { startArgumentLiveTemplate(context, method); } showParameterHints(this, context, method, methodCall); }