void (@NotNull PsiElement element, @NotNull ActionContext context, @NotNull ModPsiUpdater updater) { final PsiJavaToken token = (PsiJavaToken)element; int offset = context.offset(); final PsiElement parent = token.getParent(); if (!(parent instanceof PsiPolyadicExpression polyadicExpression)) { return; } final PsiExpression[] operands = polyadicExpression.getOperands(); final StringBuilder newExpression = new StringBuilder(); CommentTracker commentTracker = new CommentTracker(); String prevOperand = null; final String tokenText = token.getText() + ' '; // 2- -1 without the space is not legal for (PsiExpression operand : operands) { final PsiJavaToken token1 = polyadicExpression.getTokenBeforeOperand(operand); if (token == token1) { newExpression.append(commentTracker.text(operand)).append(tokenText); continue; } if (prevOperand != null) { newExpression.append(prevOperand).append(tokenText); } prevOperand = commentTracker.text(operand); } newExpression.append(prevOperand); PsiReplacementUtil.replaceExpression(polyadicExpression, newExpression.toString(), commentTracker); updater.moveTo(offset); }