@Override public String getTextForElement(PsiElement element) { final JSAssignmentExpression exp = (JSAssignmentExpression) element; final JSBinaryExpression rhs = (JSBinaryExpression) exp.getROperand(); assert (rhs != null); final IElementType sign = rhs.getOperationSign(); return this.getText(BinaryOperatorUtils.getOperatorText(sign)); }
@Override public void processIntention(@NotNull PsiElement element) throws IncorrectOperationException { final JSAssignmentExpression exp = (JSAssignmentExpression) element; final JSBinaryExpression rhs = (JSBinaryExpression) exp.getROperand(); final JSExpression lhs = exp.getLOperand(); assert (rhs != null); final IElementType sign = rhs.getOperationSign(); final String operand = BinaryOperatorUtils.getOperatorText(sign); final JSExpression rhsrhs = rhs.getROperand(); assert (rhsrhs != null); JSElementFactory.replaceExpression(exp, lhs.getText() + operand + '=' + rhsrhs.getText()); }