void (@NotNull PsiElement expression, @NotNull Editor editor, @NotNull PsiClass javaClass) { Document document = editor.getDocument(); PsiFile file = expression.getContainingFile(); Project project = expression.getProject(); SmartPsiElementPointer<PsiClass> pointer = SmartPointerManager.getInstance(project).createSmartPsiElementPointer(javaClass); int startOffset = replaceExpressionTextByNewExpressionInDocument(project, expression, document); if (!javaClass.isValid()) { javaClass = pointer.getElement(); } if (javaClass == null) return; JavaPsiClassReferenceElement item = JavaClassNameCompletionContributor.createClassLookupItem(javaClass, true); item.handleInsert(createInsertionContext(editor, file, item, startOffset)); }