PsiExpression (PsiExpression expression, int parameterNumber) { if (expression instanceof PsiBinaryExpression binaryExpression) { final PsiExpression rhs = binaryExpression.getROperand(); if (rhs == null) { return null; } final PsiExpression newExpression = addParameter(rhs, parameterNumber); if (newExpression == null) { return null; } rhs.replace(newExpression); return expression; } else if (expression instanceof PsiLiteralExpression literalExpression) { final Object value = literalExpression.getValue(); if (!(value instanceof String)) { return null; } final Project project = expression.getProject(); final PsiElementFactory factory = JavaPsiFacade.getElementFactory(project); return factory.createExpressionFromText("\"" + value + '{' + parameterNumber + "}\"", null); } else { return null; } }