void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { while (true) { PsiElement parent = element.getParent(); if (parent instanceof PsiCallExpression || parent instanceof PsiJavaCodeReferenceElement) { element = parent; } else { break; } } if (!(element instanceof PsiExpression expression)) { return; } PsiConditionalExpression conditionalExpression = replaceWithConditionalExpression(project, myText + "!=null", expression, suggestDefaultValue(expression)); selectElseBranch(conditionalExpression, updater); }