void (@NotNull ActionContext context, @NotNull PsiMethodCallExpression call, @NotNull ModPsiUpdater updater) { PsiElementFactory factory = JavaPsiFacade.getElementFactory(call.getProject()); PsiNewExpression newExpression = (PsiNewExpression)factory.createExpressionFromText("new X()",null); CommentTracker tracker = new CommentTracker(); PsiJavaCodeReferenceElement classReference = newExpression.getClassReference(); assert classReference != null; classReference.replace(factory.createClassReferenceElement(myClass)); PsiExpressionList argumentList = newExpression.getArgumentList(); assert argumentList != null; argumentList.replace(tracker.markUnchanged(call.getArgumentList())); tracker.replaceAndRestoreComments(call, newExpression); }