void (@NotNull final InsertionContext context, @NotNull LookupElement item) { final PsiClassType.ClassResolveResult resolveResult = myClassType.resolveGenerics(); final PsiClass psiClass = resolveResult.getElement(); if (psiClass == null || !psiClass.isValid()) { return; } GroovyPsiElement place = PsiTreeUtil.findElementOfClassAtOffset(context.getFile(), context.getStartOffset(), GroovyPsiElement.class, false); boolean hasParams = place != null && GroovyCompletionUtil.hasConstructorParameters(psiClass, place); if (myTriggerFeature) { FeatureUsageTracker.getInstance().triggerFeatureUsed(JavaCompletionFeatures.AFTER_NEW); } if (hasParams) { ParenthesesInsertHandler.WITH_PARAMETERS.handleInsert(context, item); } else { ParenthesesInsertHandler.NO_PARAMETERS.handleInsert(context, item); } shortenRefsInGenerics(context); if (hasParams) { AutoPopupController.getInstance(context.getProject()).autoPopupParameterInfo(context.getEditor(), null); } PsiDocumentManager.getInstance(context.getProject()).doPostponedOperationsAndUnblockDocument(context.getDocument()); if (psiClass.hasModifierProperty(PsiModifier.ABSTRACT)) { final Editor editor = context.getEditor(); final int offset = context.getTailOffset(); editor.getDocument().insertString(offset, " {}"); editor.getCaretModel().moveToOffset(offset + 2); context.setLaterRunnable(generateAnonymousBody(editor, context.getFile())); } }