Search in sources :

Example 11 with InfixExpression

use of org.eclipse.jdt.core.dom.InfixExpression in project flux by eclipse.

the class QuickAssistProcessor method getConvertStringConcatenationProposals.

private static boolean getConvertStringConcatenationProposals(IInvocationContext context, Collection<ICommandAccess> resultingCollections) {
    ASTNode node = context.getCoveringNode();
    BodyDeclaration parentDecl = ASTResolving.findParentBodyDeclaration(node);
    if (!(parentDecl instanceof MethodDeclaration || parentDecl instanceof Initializer))
        return false;
    AST ast = node.getAST();
    //$NON-NLS-1$
    ITypeBinding stringBinding = ast.resolveWellKnownType("java.lang.String");
    if (node instanceof Expression && !(node instanceof InfixExpression)) {
        node = node.getParent();
    }
    if (node instanceof VariableDeclarationFragment) {
        node = ((VariableDeclarationFragment) node).getInitializer();
    } else if (node instanceof Assignment) {
        node = ((Assignment) node).getRightHandSide();
    }
    InfixExpression oldInfixExpression = null;
    while (node instanceof InfixExpression) {
        InfixExpression curr = (InfixExpression) node;
        if (curr.resolveTypeBinding() == stringBinding && curr.getOperator() == InfixExpression.Operator.PLUS) {
            // is a infix expression we can use
            oldInfixExpression = curr;
        } else {
            break;
        }
        node = node.getParent();
    }
    if (oldInfixExpression == null)
        return false;
    if (resultingCollections == null) {
        return true;
    }
    LinkedCorrectionProposal stringBufferProposal = getConvertToStringBufferProposal(context, ast, oldInfixExpression);
    resultingCollections.add(stringBufferProposal);
    ASTRewriteCorrectionProposal messageFormatProposal = getConvertToMessageFormatProposal(context, ast, oldInfixExpression);
    if (messageFormatProposal != null)
        resultingCollections.add(messageFormatProposal);
    return true;
}
Also used : Assignment(org.eclipse.jdt.core.dom.Assignment) ASTRewriteCorrectionProposal(org.eclipse.jdt.ui.text.java.correction.ASTRewriteCorrectionProposal) AST(org.eclipse.jdt.core.dom.AST) ArrayInitializer(org.eclipse.jdt.core.dom.ArrayInitializer) Initializer(org.eclipse.jdt.core.dom.Initializer) ConditionalExpression(org.eclipse.jdt.core.dom.ConditionalExpression) ThisExpression(org.eclipse.jdt.core.dom.ThisExpression) Expression(org.eclipse.jdt.core.dom.Expression) InfixExpression(org.eclipse.jdt.core.dom.InfixExpression) CastExpression(org.eclipse.jdt.core.dom.CastExpression) VariableDeclarationExpression(org.eclipse.jdt.core.dom.VariableDeclarationExpression) PostfixExpression(org.eclipse.jdt.core.dom.PostfixExpression) ParenthesizedExpression(org.eclipse.jdt.core.dom.ParenthesizedExpression) LambdaExpression(org.eclipse.jdt.core.dom.LambdaExpression) PrefixExpression(org.eclipse.jdt.core.dom.PrefixExpression) MethodDeclaration(org.eclipse.jdt.core.dom.MethodDeclaration) VariableDeclarationFragment(org.eclipse.jdt.core.dom.VariableDeclarationFragment) LinkedCorrectionProposal(org.eclipse.jdt.internal.ui.text.correction.proposals.LinkedCorrectionProposal) ITypeBinding(org.eclipse.jdt.core.dom.ITypeBinding) ASTNode(org.eclipse.jdt.core.dom.ASTNode) InfixExpression(org.eclipse.jdt.core.dom.InfixExpression) BodyDeclaration(org.eclipse.jdt.core.dom.BodyDeclaration)

Example 12 with InfixExpression

use of org.eclipse.jdt.core.dom.InfixExpression in project flux by eclipse.

the class QuickAssistProcessor method getConvertToStringBufferProposal.

private static LinkedCorrectionProposal getConvertToStringBufferProposal(IInvocationContext context, AST ast, InfixExpression oldInfixExpression) {
    String bufferOrBuilderName;
    ICompilationUnit cu = context.getCompilationUnit();
    if (JavaModelUtil.is50OrHigher(cu.getJavaProject())) {
        //$NON-NLS-1$
        bufferOrBuilderName = "StringBuilder";
    } else {
        //$NON-NLS-1$
        bufferOrBuilderName = "StringBuffer";
    }
    ASTRewrite rewrite = ASTRewrite.create(ast);
    SimpleName existingBuffer = getEnclosingAppendBuffer(oldInfixExpression);
    String mechanismName = BasicElementLabels.getJavaElementName(existingBuffer == null ? bufferOrBuilderName : existingBuffer.getIdentifier());
    String label = Messages.format(CorrectionMessages.QuickAssistProcessor_convert_to_string_buffer_description, mechanismName);
    //Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
    LinkedCorrectionProposal proposal = new LinkedCorrectionProposal(label, cu, rewrite, IProposalRelevance.CONVERT_TO_STRING_BUFFER);
    proposal.setCommandId(CONVERT_TO_STRING_BUFFER_ID);
    Statement insertAfter;
    String bufferName;
    //$NON-NLS-1$
    String groupID = "nameId";
    ListRewrite listRewrite;
    Statement enclosingStatement = ASTResolving.findParentStatement(oldInfixExpression);
    if (existingBuffer != null) {
        if (ASTNodes.isControlStatementBody(enclosingStatement.getLocationInParent())) {
            Block newBlock = ast.newBlock();
            listRewrite = rewrite.getListRewrite(newBlock, Block.STATEMENTS_PROPERTY);
            insertAfter = null;
            rewrite.replace(enclosingStatement, newBlock, null);
        } else {
            listRewrite = rewrite.getListRewrite(enclosingStatement.getParent(), (ChildListPropertyDescriptor) enclosingStatement.getLocationInParent());
            insertAfter = enclosingStatement;
        }
        bufferName = existingBuffer.getIdentifier();
    } else {
        // create buffer
        VariableDeclarationFragment frag = ast.newVariableDeclarationFragment();
        // check if name is already in use and provide alternative
        List<String> fExcludedVariableNames = Arrays.asList(ASTResolving.getUsedVariableNames(oldInfixExpression));
        SimpleType bufferType = ast.newSimpleType(ast.newName(bufferOrBuilderName));
        ClassInstanceCreation newBufferExpression = ast.newClassInstanceCreation();
        //StubUtility.getVariableNameSuggestions(NamingConventions.VK_LOCAL, cu.getJavaProject(), bufferOrBuilderName, 0, fExcludedVariableNames, true);
        String[] newBufferNames = new String[] {};
        bufferName = newBufferNames[0];
        SimpleName bufferNameDeclaration = ast.newSimpleName(bufferName);
        frag.setName(bufferNameDeclaration);
        proposal.addLinkedPosition(rewrite.track(bufferNameDeclaration), true, groupID);
        for (int i = 0; i < newBufferNames.length; i++) {
            proposal.addLinkedPositionProposal(groupID, newBufferNames[i], null);
        }
        newBufferExpression.setType(bufferType);
        frag.setInitializer(newBufferExpression);
        VariableDeclarationStatement bufferDeclaration = ast.newVariableDeclarationStatement(frag);
        bufferDeclaration.setType(ast.newSimpleType(ast.newName(bufferOrBuilderName)));
        insertAfter = bufferDeclaration;
        Statement statement = ASTResolving.findParentStatement(oldInfixExpression);
        if (ASTNodes.isControlStatementBody(statement.getLocationInParent())) {
            Block newBlock = ast.newBlock();
            listRewrite = rewrite.getListRewrite(newBlock, Block.STATEMENTS_PROPERTY);
            listRewrite.insertFirst(bufferDeclaration, null);
            listRewrite.insertLast(rewrite.createMoveTarget(statement), null);
            rewrite.replace(statement, newBlock, null);
        } else {
            listRewrite = rewrite.getListRewrite(statement.getParent(), (ChildListPropertyDescriptor) statement.getLocationInParent());
            listRewrite.insertBefore(bufferDeclaration, statement, null);
        }
    }
    List<Expression> operands = new ArrayList<Expression>();
    collectInfixPlusOperands(oldInfixExpression, operands);
    Statement lastAppend = insertAfter;
    for (Iterator<Expression> iter = operands.iterator(); iter.hasNext(); ) {
        Expression operand = iter.next();
        MethodInvocation appendIncovationExpression = ast.newMethodInvocation();
        //$NON-NLS-1$
        appendIncovationExpression.setName(ast.newSimpleName("append"));
        SimpleName bufferNameReference = ast.newSimpleName(bufferName);
        // If there was an existing name, don't offer to rename it
        if (existingBuffer == null) {
            proposal.addLinkedPosition(rewrite.track(bufferNameReference), true, groupID);
        }
        appendIncovationExpression.setExpression(bufferNameReference);
        appendIncovationExpression.arguments().add(rewrite.createCopyTarget(operand));
        ExpressionStatement appendExpressionStatement = ast.newExpressionStatement(appendIncovationExpression);
        if (lastAppend == null) {
            listRewrite.insertFirst(appendExpressionStatement, null);
        } else {
            listRewrite.insertAfter(appendExpressionStatement, lastAppend, null);
        }
        lastAppend = appendExpressionStatement;
    }
    if (existingBuffer != null) {
        proposal.setEndPosition(rewrite.track(lastAppend));
        if (insertAfter != null) {
            rewrite.remove(enclosingStatement, null);
        }
    } else {
        // replace old expression with toString
        MethodInvocation bufferToString = ast.newMethodInvocation();
        //$NON-NLS-1$
        bufferToString.setName(ast.newSimpleName("toString"));
        SimpleName bufferNameReference = ast.newSimpleName(bufferName);
        bufferToString.setExpression(bufferNameReference);
        proposal.addLinkedPosition(rewrite.track(bufferNameReference), true, groupID);
        rewrite.replace(oldInfixExpression, bufferToString, null);
        proposal.setEndPosition(rewrite.track(bufferToString));
    }
    return proposal;
}
Also used : ClassInstanceCreation(org.eclipse.jdt.core.dom.ClassInstanceCreation) ICompilationUnit(org.eclipse.jdt.core.ICompilationUnit) DoStatement(org.eclipse.jdt.core.dom.DoStatement) Statement(org.eclipse.jdt.core.dom.Statement) EnhancedForStatement(org.eclipse.jdt.core.dom.EnhancedForStatement) ExpressionStatement(org.eclipse.jdt.core.dom.ExpressionStatement) TryStatement(org.eclipse.jdt.core.dom.TryStatement) IfStatement(org.eclipse.jdt.core.dom.IfStatement) WhileStatement(org.eclipse.jdt.core.dom.WhileStatement) ReturnStatement(org.eclipse.jdt.core.dom.ReturnStatement) ForStatement(org.eclipse.jdt.core.dom.ForStatement) VariableDeclarationStatement(org.eclipse.jdt.core.dom.VariableDeclarationStatement) SimpleName(org.eclipse.jdt.core.dom.SimpleName) ArrayList(java.util.ArrayList) MethodInvocation(org.eclipse.jdt.core.dom.MethodInvocation) SuperMethodInvocation(org.eclipse.jdt.core.dom.SuperMethodInvocation) ListRewrite(org.eclipse.jdt.core.dom.rewrite.ListRewrite) ChildListPropertyDescriptor(org.eclipse.jdt.core.dom.ChildListPropertyDescriptor) SimpleType(org.eclipse.jdt.core.dom.SimpleType) ConditionalExpression(org.eclipse.jdt.core.dom.ConditionalExpression) ThisExpression(org.eclipse.jdt.core.dom.ThisExpression) Expression(org.eclipse.jdt.core.dom.Expression) InfixExpression(org.eclipse.jdt.core.dom.InfixExpression) CastExpression(org.eclipse.jdt.core.dom.CastExpression) VariableDeclarationExpression(org.eclipse.jdt.core.dom.VariableDeclarationExpression) PostfixExpression(org.eclipse.jdt.core.dom.PostfixExpression) ParenthesizedExpression(org.eclipse.jdt.core.dom.ParenthesizedExpression) LambdaExpression(org.eclipse.jdt.core.dom.LambdaExpression) PrefixExpression(org.eclipse.jdt.core.dom.PrefixExpression) LinkedCorrectionProposal(org.eclipse.jdt.internal.ui.text.correction.proposals.LinkedCorrectionProposal) VariableDeclarationFragment(org.eclipse.jdt.core.dom.VariableDeclarationFragment) ExpressionStatement(org.eclipse.jdt.core.dom.ExpressionStatement) ASTRewrite(org.eclipse.jdt.core.dom.rewrite.ASTRewrite) Block(org.eclipse.jdt.core.dom.Block) VariableDeclarationStatement(org.eclipse.jdt.core.dom.VariableDeclarationStatement)

Example 13 with InfixExpression

use of org.eclipse.jdt.core.dom.InfixExpression in project flux by eclipse.

the class QuickAssistProcessor method getInvertEqualsProposal.

private static boolean getInvertEqualsProposal(IInvocationContext context, ASTNode node, Collection<ICommandAccess> resultingCollections) {
    if (!(node instanceof MethodInvocation)) {
        node = node.getParent();
        if (!(node instanceof MethodInvocation)) {
            return false;
        }
    }
    MethodInvocation method = (MethodInvocation) node;
    String identifier = method.getName().getIdentifier();
    if (!"equals".equals(identifier) && !"equalsIgnoreCase".equals(identifier)) {
        //$NON-NLS-1$ //$NON-NLS-2$
        return false;
    }
    List<Expression> arguments = method.arguments();
    if (arguments.size() != 1) {
        //overloaded equals w/ more than 1 argument
        return false;
    }
    Expression right = arguments.get(0);
    ITypeBinding binding = right.resolveTypeBinding();
    if (binding != null && !(binding.isClass() || binding.isInterface() || binding.isEnum())) {
        //overloaded equals w/ non-class/interface argument or null
        return false;
    }
    if (resultingCollections == null) {
        return true;
    }
    Expression left = method.getExpression();
    AST ast = method.getAST();
    ASTRewrite rewrite = ASTRewrite.create(ast);
    if (left == null) {
        // equals(x) -> x.equals(this)
        MethodInvocation replacement = ast.newMethodInvocation();
        replacement.setName((SimpleName) rewrite.createCopyTarget(method.getName()));
        replacement.arguments().add(ast.newThisExpression());
        replacement.setExpression((Expression) rewrite.createCopyTarget(right));
        rewrite.replace(method, replacement, null);
    } else if (right instanceof ThisExpression) {
        // x.equals(this) -> equals(x)
        MethodInvocation replacement = ast.newMethodInvocation();
        replacement.setName((SimpleName) rewrite.createCopyTarget(method.getName()));
        replacement.arguments().add(rewrite.createCopyTarget(left));
        rewrite.replace(method, replacement, null);
    } else {
        ASTNode leftExpression = left;
        while (leftExpression instanceof ParenthesizedExpression) {
            leftExpression = ((ParenthesizedExpression) left).getExpression();
        }
        rewrite.replace(right, rewrite.createCopyTarget(leftExpression), null);
        if (right instanceof CastExpression || right instanceof Assignment || right instanceof ConditionalExpression || right instanceof InfixExpression) {
            ParenthesizedExpression paren = ast.newParenthesizedExpression();
            paren.setExpression((Expression) rewrite.createCopyTarget(right));
            rewrite.replace(left, paren, null);
        } else {
            rewrite.replace(left, rewrite.createCopyTarget(right), null);
        }
    }
    String label = CorrectionMessages.QuickAssistProcessor_invertequals_description;
    //		Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
    LinkedCorrectionProposal proposal = new LinkedCorrectionProposal(label, context.getCompilationUnit(), rewrite, IProposalRelevance.INVERT_EQUALS);
    resultingCollections.add(proposal);
    return true;
}
Also used : ParenthesizedExpression(org.eclipse.jdt.core.dom.ParenthesizedExpression) AST(org.eclipse.jdt.core.dom.AST) SimpleName(org.eclipse.jdt.core.dom.SimpleName) ConditionalExpression(org.eclipse.jdt.core.dom.ConditionalExpression) MethodInvocation(org.eclipse.jdt.core.dom.MethodInvocation) SuperMethodInvocation(org.eclipse.jdt.core.dom.SuperMethodInvocation) Assignment(org.eclipse.jdt.core.dom.Assignment) ThisExpression(org.eclipse.jdt.core.dom.ThisExpression) ConditionalExpression(org.eclipse.jdt.core.dom.ConditionalExpression) ThisExpression(org.eclipse.jdt.core.dom.ThisExpression) Expression(org.eclipse.jdt.core.dom.Expression) InfixExpression(org.eclipse.jdt.core.dom.InfixExpression) CastExpression(org.eclipse.jdt.core.dom.CastExpression) VariableDeclarationExpression(org.eclipse.jdt.core.dom.VariableDeclarationExpression) PostfixExpression(org.eclipse.jdt.core.dom.PostfixExpression) ParenthesizedExpression(org.eclipse.jdt.core.dom.ParenthesizedExpression) LambdaExpression(org.eclipse.jdt.core.dom.LambdaExpression) PrefixExpression(org.eclipse.jdt.core.dom.PrefixExpression) LinkedCorrectionProposal(org.eclipse.jdt.internal.ui.text.correction.proposals.LinkedCorrectionProposal) ITypeBinding(org.eclipse.jdt.core.dom.ITypeBinding) ASTNode(org.eclipse.jdt.core.dom.ASTNode) InfixExpression(org.eclipse.jdt.core.dom.InfixExpression) ASTRewrite(org.eclipse.jdt.core.dom.rewrite.ASTRewrite) CastExpression(org.eclipse.jdt.core.dom.CastExpression)

Example 14 with InfixExpression

use of org.eclipse.jdt.core.dom.InfixExpression in project flux by eclipse.

the class AdvancedQuickAssistProcessor method getSplitAndConditionProposals.

public static boolean getSplitAndConditionProposals(IInvocationContext context, ASTNode node, Collection<ICommandAccess> resultingCollections) {
    Operator andOperator = InfixExpression.Operator.CONDITIONAL_AND;
    // check that user invokes quick assist on infix expression
    if (!(node instanceof InfixExpression)) {
        return false;
    }
    InfixExpression infixExpression = (InfixExpression) node;
    if (infixExpression.getOperator() != andOperator) {
        return false;
    }
    int offset = isOperatorSelected(infixExpression, context.getSelectionOffset(), context.getSelectionLength());
    if (offset == -1) {
        return false;
    }
    // check that infix expression belongs to IfStatement
    Statement statement = ASTResolving.findParentStatement(node);
    if (!(statement instanceof IfStatement)) {
        return false;
    }
    IfStatement ifStatement = (IfStatement) statement;
    // check that infix expression is part of first level && condition of IfStatement
    InfixExpression topInfixExpression = infixExpression;
    while (topInfixExpression.getParent() instanceof InfixExpression && ((InfixExpression) topInfixExpression.getParent()).getOperator() == andOperator) {
        topInfixExpression = (InfixExpression) topInfixExpression.getParent();
    }
    if (ifStatement.getExpression() != topInfixExpression) {
        return false;
    }
    //
    if (resultingCollections == null) {
        return true;
    }
    AST ast = ifStatement.getAST();
    ASTRewrite rewrite = ASTRewrite.create(ast);
    // prepare left and right conditions
    Expression[] newOperands = { null, null };
    breakInfixOperationAtOperation(rewrite, topInfixExpression, andOperator, offset, true, newOperands);
    Expression leftCondition = newOperands[0];
    Expression rightCondition = newOperands[1];
    // replace conditions in outer IfStatement
    rewrite.set(ifStatement, IfStatement.EXPRESSION_PROPERTY, leftCondition, null);
    // prepare inner IfStatement
    IfStatement innerIf = ast.newIfStatement();
    innerIf.setExpression(rightCondition);
    innerIf.setThenStatement((Statement) rewrite.createMoveTarget(ifStatement.getThenStatement()));
    Block innerBlock = ast.newBlock();
    innerBlock.statements().add(innerIf);
    Statement elseStatement = ifStatement.getElseStatement();
    if (elseStatement != null) {
        innerIf.setElseStatement((Statement) rewrite.createCopyTarget(elseStatement));
    }
    // replace outer thenStatement
    rewrite.replace(ifStatement.getThenStatement(), innerBlock, null);
    // add correction proposal
    String label = CorrectionMessages.AdvancedQuickAssistProcessor_splitAndCondition_description;
    //		Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
    ASTRewriteCorrectionProposal proposal = new ASTRewriteCorrectionProposal(label, context.getCompilationUnit(), rewrite, IProposalRelevance.SPLIT_AND_CONDITION);
    resultingCollections.add(proposal);
    return true;
}
Also used : Operator(org.eclipse.jdt.core.dom.InfixExpression.Operator) ASTRewriteCorrectionProposal(org.eclipse.jdt.ui.text.java.correction.ASTRewriteCorrectionProposal) IfStatement(org.eclipse.jdt.core.dom.IfStatement) AST(org.eclipse.jdt.core.dom.AST) ConditionalExpression(org.eclipse.jdt.core.dom.ConditionalExpression) InstanceofExpression(org.eclipse.jdt.core.dom.InstanceofExpression) Expression(org.eclipse.jdt.core.dom.Expression) InfixExpression(org.eclipse.jdt.core.dom.InfixExpression) CastExpression(org.eclipse.jdt.core.dom.CastExpression) ParenthesizedExpression(org.eclipse.jdt.core.dom.ParenthesizedExpression) LambdaExpression(org.eclipse.jdt.core.dom.LambdaExpression) PrefixExpression(org.eclipse.jdt.core.dom.PrefixExpression) DoStatement(org.eclipse.jdt.core.dom.DoStatement) Statement(org.eclipse.jdt.core.dom.Statement) ContinueStatement(org.eclipse.jdt.core.dom.ContinueStatement) EnhancedForStatement(org.eclipse.jdt.core.dom.EnhancedForStatement) ExpressionStatement(org.eclipse.jdt.core.dom.ExpressionStatement) AssertStatement(org.eclipse.jdt.core.dom.AssertStatement) SwitchStatement(org.eclipse.jdt.core.dom.SwitchStatement) IfStatement(org.eclipse.jdt.core.dom.IfStatement) WhileStatement(org.eclipse.jdt.core.dom.WhileStatement) ReturnStatement(org.eclipse.jdt.core.dom.ReturnStatement) BreakStatement(org.eclipse.jdt.core.dom.BreakStatement) ForStatement(org.eclipse.jdt.core.dom.ForStatement) VariableDeclarationStatement(org.eclipse.jdt.core.dom.VariableDeclarationStatement) InfixExpression(org.eclipse.jdt.core.dom.InfixExpression) ASTRewrite(org.eclipse.jdt.core.dom.rewrite.ASTRewrite) Block(org.eclipse.jdt.core.dom.Block)

Example 15 with InfixExpression

use of org.eclipse.jdt.core.dom.InfixExpression in project flux by eclipse.

the class AdvancedQuickAssistProcessor method breakInfixOperationAtOperation.

/*
	 * Breaks an infix operation with possible extended operators at the given operator and returns the new left and right operands.
	 * a & b & c   ->  [[a' & b' ] & c' ]   (c' == copy of c)
	 */
private static void breakInfixOperationAtOperation(ASTRewrite rewrite, Expression expression, Operator operator, int operatorOffset, boolean removeParentheses, Expression[] res) {
    if (expression.getStartPosition() + expression.getLength() <= operatorOffset) {
        // add to the left
        res[0] = combineOperands(rewrite, res[0], expression, removeParentheses, operator);
        return;
    }
    if (operatorOffset <= expression.getStartPosition()) {
        // add to the right
        res[1] = combineOperands(rewrite, res[1], expression, removeParentheses, operator);
        return;
    }
    if (!(expression instanceof InfixExpression)) {
        //$NON-NLS-1$
        throw new IllegalArgumentException("Cannot break up non-infix expression");
    }
    InfixExpression infixExpression = (InfixExpression) expression;
    if (infixExpression.getOperator() != operator) {
        //$NON-NLS-1$
        throw new IllegalArgumentException("Incompatible operator");
    }
    breakInfixOperationAtOperation(rewrite, infixExpression.getLeftOperand(), operator, operatorOffset, removeParentheses, res);
    breakInfixOperationAtOperation(rewrite, infixExpression.getRightOperand(), operator, operatorOffset, removeParentheses, res);
    List<Expression> extended = infixExpression.extendedOperands();
    for (int i = 0; i < extended.size(); i++) {
        breakInfixOperationAtOperation(rewrite, extended.get(i), operator, operatorOffset, removeParentheses, res);
    }
}
Also used : ConditionalExpression(org.eclipse.jdt.core.dom.ConditionalExpression) InstanceofExpression(org.eclipse.jdt.core.dom.InstanceofExpression) Expression(org.eclipse.jdt.core.dom.Expression) InfixExpression(org.eclipse.jdt.core.dom.InfixExpression) CastExpression(org.eclipse.jdt.core.dom.CastExpression) ParenthesizedExpression(org.eclipse.jdt.core.dom.ParenthesizedExpression) LambdaExpression(org.eclipse.jdt.core.dom.LambdaExpression) PrefixExpression(org.eclipse.jdt.core.dom.PrefixExpression) InfixExpression(org.eclipse.jdt.core.dom.InfixExpression)

Aggregations

InfixExpression (org.eclipse.jdt.core.dom.InfixExpression)73 Expression (org.eclipse.jdt.core.dom.Expression)50 PrefixExpression (org.eclipse.jdt.core.dom.PrefixExpression)40 ParenthesizedExpression (org.eclipse.jdt.core.dom.ParenthesizedExpression)30 ConditionalExpression (org.eclipse.jdt.core.dom.ConditionalExpression)23 CastExpression (org.eclipse.jdt.core.dom.CastExpression)22 LambdaExpression (org.eclipse.jdt.core.dom.LambdaExpression)19 AST (org.eclipse.jdt.core.dom.AST)18 InstanceofExpression (org.eclipse.jdt.core.dom.InstanceofExpression)16 ASTNode (org.eclipse.jdt.core.dom.ASTNode)13 ASTRewrite (org.eclipse.jdt.core.dom.rewrite.ASTRewrite)12 ITypeBinding (org.eclipse.jdt.core.dom.ITypeBinding)10 Operator (org.eclipse.jdt.core.dom.InfixExpression.Operator)10 MethodInvocation (org.eclipse.jdt.core.dom.MethodInvocation)10 PostfixExpression (org.eclipse.jdt.core.dom.PostfixExpression)10 Assignment (org.eclipse.jdt.core.dom.Assignment)8 VariableDeclarationExpression (org.eclipse.jdt.core.dom.VariableDeclarationExpression)8 ASTRewriteCorrectionProposal (org.eclipse.jdt.ui.text.java.correction.ASTRewriteCorrectionProposal)8 ASTBuilder (org.autorefactor.refactoring.ASTBuilder)7 SimpleName (org.eclipse.jdt.core.dom.SimpleName)7