Search in sources :

Example 21 with Operator

use of org.eclipse.jdt.core.dom.InfixExpression.Operator in project AutoRefactor by JnRouvignac.

the class SimplifyExpressionRefactoring method isInnerExprHardToRead.

/**
 * Returns whether the supplied expression is complex enough to read.
 *
 * @param innerExpr
 *          the inner expression to test for ease of read
 * @param parent
 *          the parent node to test for ease of read
 * @return true if the expressions is hard to read, false otherwise
 */
private boolean isInnerExprHardToRead(final Expression innerExpr, final ASTNode parent) {
    if (parent instanceof InfixExpression) {
        if (innerExpr instanceof InfixExpression) {
            final InfixExpression innerIe = (InfixExpression) innerExpr;
            final Operator innerOp = innerIe.getOperator();
            final Operator parentOp = ((InfixExpression) parent).getOperator();
            if (Operator.EQUALS.equals(parentOp) || shouldHaveParentheses(innerOp, parentOp)) {
                return true;
            }
            return is(innerIe.getLeftOperand(), Assignment.class) || is(innerIe.getRightOperand(), Assignment.class);
        }
    } else if (parent instanceof ConditionalExpression) {
        return innerExpr instanceof ConditionalExpression || innerExpr instanceof Assignment || innerExpr instanceof InstanceofExpression || innerExpr instanceof InfixExpression;
    }
    return false;
}
Also used : Operator(org.eclipse.jdt.core.dom.InfixExpression.Operator) Assignment(org.eclipse.jdt.core.dom.Assignment) ConditionalExpression(org.eclipse.jdt.core.dom.ConditionalExpression) InstanceofExpression(org.eclipse.jdt.core.dom.InstanceofExpression) InfixExpression(org.eclipse.jdt.core.dom.InfixExpression)

Example 22 with Operator

use of org.eclipse.jdt.core.dom.InfixExpression.Operator in project AutoRefactor by JnRouvignac.

the class SimplifyExpressionRefactoring method shouldHaveParentheses.

private boolean shouldHaveParentheses(Operator actualChildOp, Operator actualParentOp) {
    for (Pair<Operator, Operator> pair : SHOULD_HAVE_PARENTHESES) {
        final Operator childOp = pair.getFirst();
        final Operator parentOp = pair.getSecond();
        if (childOp.equals(actualChildOp) && parentOp.equals(actualParentOp)) {
            return true;
        }
    }
    return false;
}
Also used : Operator(org.eclipse.jdt.core.dom.InfixExpression.Operator)

Example 23 with Operator

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

the class AdvancedQuickAssistProcessor method getSplitOrConditionProposals.

// 
// private static boolean getJoinOrIfStatementsProposals(IInvocationContext context, ASTNode covering, ArrayList<ASTNode> coveredNodes, Collection<ICommandAccess> resultingCollections) {
// Operator orOperator = InfixExpression.Operator.CONDITIONAL_OR;
// if (coveredNodes.size() < 2) {
// return false;
// }
// // check that all covered nodes are IfStatement's with same 'then' statement and without 'else'
// String commonThenSource = null;
// for (Iterator<ASTNode> iter = coveredNodes.iterator(); iter.hasNext();) {
// ASTNode node = iter.next();
// if (!(node instanceof IfStatement)) {
// return false;
// }
// //
// IfStatement ifStatement = (IfStatement) node;
// if (ifStatement.getElseStatement() != null) {
// return false;
// }
// //
// Statement thenStatement = ifStatement.getThenStatement();
// try {
// String thenSource = context.getCompilationUnit().getBuffer().getText(thenStatement.getStartPosition(), thenStatement.getLength());
// if (commonThenSource == null) {
// commonThenSource = thenSource;
// } else {
// if (!commonThenSource.equals(thenSource)) {
// return false;
// }
// }
// } catch (Throwable e) {
// return false;
// }
// }
// if (resultingCollections == null) {
// return true;
// }
// //
// final AST ast = covering.getAST();
// final ASTRewrite rewrite = ASTRewrite.create(ast);
// // prepare OR'ed condition
// InfixExpression condition = null;
// boolean hasRightOperand = false;
// Statement thenStatement = null;
// for (Iterator<ASTNode> iter = coveredNodes.iterator(); iter.hasNext();) {
// IfStatement ifStatement = (IfStatement) iter.next();
// if (thenStatement == null) {
// thenStatement = (Statement) rewrite.createCopyTarget(ifStatement.getThenStatement());
// }
// if (condition == null) {
// condition = ast.newInfixExpression();
// condition.setOperator(orOperator);
// condition.setLeftOperand(getParenthesizedExpressionIfNeeded(ast, rewrite, ifStatement.getExpression(), condition, InfixExpression.LEFT_OPERAND_PROPERTY));
// } else if (!hasRightOperand) {
// condition.setRightOperand(getParenthesizedExpressionIfNeeded(ast, rewrite, ifStatement.getExpression(), condition, InfixExpression.RIGHT_OPERAND_PROPERTY));
// hasRightOperand = true;
// } else {
// InfixExpression newCondition = ast.newInfixExpression();
// newCondition.setOperator(orOperator);
// newCondition.setLeftOperand(condition);
// newCondition.setRightOperand(getParenthesizedExpressionIfNeeded(ast, rewrite, ifStatement.getExpression(), condition, InfixExpression.RIGHT_OPERAND_PROPERTY));
// condition = newCondition;
// }
// }
// // prepare new IfStatement with OR'ed condition
// IfStatement newIf = ast.newIfStatement();
// newIf.setExpression(condition);
// newIf.setThenStatement(thenStatement);
// //
// ListRewrite listRewriter = null;
// for (Iterator<ASTNode> iter = coveredNodes.iterator(); iter.hasNext();) {
// IfStatement ifStatement = (IfStatement) iter.next();
// if (listRewriter == null) {
// Block sourceBlock = (Block) ifStatement.getParent();
// //int insertIndex = sourceBlock.statements().indexOf(ifStatement);
// listRewriter = rewrite.getListRewrite(sourceBlock, (ChildListPropertyDescriptor) ifStatement.getLocationInParent());
// }
// if (newIf != null) {
// listRewriter.replace(ifStatement, newIf, null);
// newIf = null;
// } else {
// listRewriter.remove(ifStatement, null);
// }
// }
// // add correction proposal
// String label = CorrectionMessages.AdvancedQuickAssistProcessor_joinWithOr_description;
// Image image = JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
// ASTRewriteCorrectionProposal proposal = new ASTRewriteCorrectionProposal(label, context.getCompilationUnit(), rewrite, IProposalRelevance.JOIN_IF_STATEMENTS_WITH_OR, image);
// resultingCollections.add(proposal);
// return true;
// }
// 
public static boolean getSplitOrConditionProposals(IInvocationContext context, ASTNode node, Collection<CUCorrectionProposal> resultingCollections) {
    Operator orOperator = InfixExpression.Operator.CONDITIONAL_OR;
    // check that user invokes quick assist on infix expression
    if (!(node instanceof InfixExpression)) {
        return false;
    }
    InfixExpression infixExpression = (InfixExpression) node;
    if (infixExpression.getOperator() != orOperator) {
        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() == orOperator) {
        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, orOperator, offset, true, newOperands);
    Expression leftCondition = newOperands[0];
    Expression rightCondition = newOperands[1];
    // prepare first statement
    rewrite.replace(ifStatement.getExpression(), leftCondition, null);
    IfStatement secondIf = ast.newIfStatement();
    secondIf.setExpression(rightCondition);
    secondIf.setThenStatement((Statement) rewrite.createCopyTarget(ifStatement.getThenStatement()));
    Statement elseStatement = ifStatement.getElseStatement();
    if (elseStatement == null) {
        rewrite.set(ifStatement, IfStatement.ELSE_STATEMENT_PROPERTY, secondIf, null);
    } else {
        rewrite.replace(elseStatement, secondIf, null);
        secondIf.setElseStatement((Statement) rewrite.createMoveTarget(elseStatement));
    }
    // add correction proposal
    String label = CorrectionMessages.AdvancedQuickAssistProcessor_splitOrCondition_description;
    ASTRewriteCorrectionProposal proposal = new ASTRewriteCorrectionProposal(label, context.getCompilationUnit(), rewrite, IProposalRelevance.SPLIT_OR_CONDITION);
    resultingCollections.add(proposal);
    return true;
}
Also used : Operator(org.eclipse.jdt.core.dom.InfixExpression.Operator) ASTRewriteCorrectionProposal(org.eclipse.jdt.ls.core.internal.corrections.proposals.ASTRewriteCorrectionProposal) IfStatement(org.eclipse.jdt.core.dom.IfStatement) AST(org.eclipse.jdt.core.dom.AST) InfixExpression(org.eclipse.jdt.core.dom.InfixExpression) Expression(org.eclipse.jdt.core.dom.Expression) ParenthesizedExpression(org.eclipse.jdt.core.dom.ParenthesizedExpression) Statement(org.eclipse.jdt.core.dom.Statement) IfStatement(org.eclipse.jdt.core.dom.IfStatement) InfixExpression(org.eclipse.jdt.core.dom.InfixExpression) ASTRewrite(org.eclipse.jdt.core.dom.rewrite.ASTRewrite)

Example 24 with Operator

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

the class AdvancedQuickAssistProcessor method getSplitOrConditionProposals.

public static boolean getSplitOrConditionProposals(IInvocationContext context, ASTNode node, Collection<ICommandAccess> resultingCollections) {
    Operator orOperator = InfixExpression.Operator.CONDITIONAL_OR;
    // check that user invokes quick assist on infix expression
    if (!(node instanceof InfixExpression)) {
        return false;
    }
    InfixExpression infixExpression = (InfixExpression) node;
    if (infixExpression.getOperator() != orOperator) {
        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() == orOperator) {
        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, orOperator, offset, true, newOperands);
    Expression leftCondition = newOperands[0];
    Expression rightCondition = newOperands[1];
    // prepare first statement
    rewrite.replace(ifStatement.getExpression(), leftCondition, null);
    IfStatement secondIf = ast.newIfStatement();
    secondIf.setExpression(rightCondition);
    secondIf.setThenStatement((Statement) rewrite.createCopyTarget(ifStatement.getThenStatement()));
    Statement elseStatement = ifStatement.getElseStatement();
    if (elseStatement == null) {
        rewrite.set(ifStatement, IfStatement.ELSE_STATEMENT_PROPERTY, secondIf, null);
    } else {
        rewrite.replace(elseStatement, secondIf, null);
        secondIf.setElseStatement((Statement) rewrite.createMoveTarget(elseStatement));
    }
    // add correction proposal
    String label = CorrectionMessages.AdvancedQuickAssistProcessor_splitOrCondition_description;
    // Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
    ASTRewriteCorrectionProposal proposal = new ASTRewriteCorrectionProposal(label, context.getCompilationUnit(), rewrite, IProposalRelevance.SPLIT_OR_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)

Example 25 with Operator

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

the class AdvancedQuickAssistProcessor method getInverseLocalVariableProposals.

private static boolean getInverseLocalVariableProposals(IInvocationContext context, ASTNode covering, Collection<ICommandAccess> resultingCollections) {
    final AST ast = covering.getAST();
    // cursor should be placed on variable name
    if (!(covering instanceof SimpleName)) {
        return false;
    }
    SimpleName coveringName = (SimpleName) covering;
    if (!coveringName.isDeclaration()) {
        return false;
    }
    // prepare bindings
    final IBinding variableBinding = coveringName.resolveBinding();
    if (!(variableBinding instanceof IVariableBinding)) {
        return false;
    }
    IVariableBinding binding = (IVariableBinding) variableBinding;
    if (binding.isField()) {
        return false;
    }
    // we operate only on boolean variable
    if (!isBoolean(coveringName)) {
        return false;
    }
    // we could produce quick assist
    if (resultingCollections == null) {
        return true;
    }
    // find linked nodes
    final MethodDeclaration method = ASTResolving.findParentMethodDeclaration(covering);
    SimpleName[] linkedNodes = LinkedNodeFinder.findByBinding(method, variableBinding);
    // 
    final ASTRewrite rewrite = ASTRewrite.create(ast);
    // create proposal
    String label = CorrectionMessages.AdvancedQuickAssistProcessor_inverseBooleanVariable;
    // Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
    // $NON-NLS-1$
    final String KEY_NAME = "name";
    final LinkedCorrectionProposal proposal = new LinkedCorrectionProposal(label, context.getCompilationUnit(), rewrite, IProposalRelevance.INVERSE_BOOLEAN_VARIABLE);
    // prepare new variable identifier
    final String oldIdentifier = coveringName.getIdentifier();
    // $NON-NLS-1$
    final String notString = Messages.format(CorrectionMessages.AdvancedQuickAssistProcessor_negatedVariableName, "");
    final String newIdentifier;
    if (oldIdentifier.startsWith(notString)) {
        int notLength = notString.length();
        if (oldIdentifier.length() > notLength) {
            newIdentifier = Character.toLowerCase(oldIdentifier.charAt(notLength)) + oldIdentifier.substring(notLength + 1);
        } else {
            newIdentifier = oldIdentifier;
        }
    } else {
        newIdentifier = Messages.format(CorrectionMessages.AdvancedQuickAssistProcessor_negatedVariableName, Character.toUpperCase(oldIdentifier.charAt(0)) + oldIdentifier.substring(1));
    }
    // 
    proposal.addLinkedPositionProposal(KEY_NAME, newIdentifier, null);
    proposal.addLinkedPositionProposal(KEY_NAME, oldIdentifier, null);
    // iterate over linked nodes and replace variable references with negated reference
    final HashSet<SimpleName> renamedNames = new HashSet<SimpleName>();
    for (int i = 0; i < linkedNodes.length; i++) {
        SimpleName name = linkedNodes[i];
        if (renamedNames.contains(name)) {
            continue;
        }
        // prepare new name with new identifier
        SimpleName newName = ast.newSimpleName(newIdentifier);
        proposal.addLinkedPosition(rewrite.track(newName), name == coveringName, KEY_NAME);
        // 
        StructuralPropertyDescriptor location = name.getLocationInParent();
        if (location == SingleVariableDeclaration.NAME_PROPERTY) {
            // set new name
            rewrite.replace(name, newName, null);
        } else if (location == Assignment.LEFT_HAND_SIDE_PROPERTY) {
            Assignment assignment = (Assignment) name.getParent();
            Expression expression = assignment.getRightHandSide();
            int exStart = expression.getStartPosition();
            int exEnd = exStart + expression.getLength();
            // collect all names that are used in assignments
            HashSet<SimpleName> overlapNames = new HashSet<SimpleName>();
            for (int j = 0; j < linkedNodes.length; j++) {
                SimpleName name2 = linkedNodes[j];
                if (name2 == null) {
                    continue;
                }
                int name2Start = name2.getStartPosition();
                if (exStart <= name2Start && name2Start < exEnd) {
                    overlapNames.add(name2);
                }
            }
            // prepare inverted expression
            SimpleNameRenameProvider provider = new SimpleNameRenameProvider() {

                public SimpleName getRenamed(SimpleName simpleName) {
                    if (simpleName.resolveBinding() == variableBinding) {
                        renamedNames.add(simpleName);
                        return ast.newSimpleName(newIdentifier);
                    }
                    return null;
                }
            };
            Expression inversedExpression = getInversedExpression(rewrite, expression, provider);
            // if any name was not renamed during expression inverting, we can not already rename it, so fail to create assist
            for (Iterator<SimpleName> iter = overlapNames.iterator(); iter.hasNext(); ) {
                Object o = iter.next();
                if (!renamedNames.contains(o)) {
                    return false;
                }
            }
            // check operator and replace if needed
            Assignment.Operator operator = assignment.getOperator();
            if (operator == Assignment.Operator.BIT_AND_ASSIGN) {
                Assignment newAssignment = ast.newAssignment();
                newAssignment.setLeftHandSide(newName);
                newAssignment.setRightHandSide(inversedExpression);
                newAssignment.setOperator(Assignment.Operator.BIT_OR_ASSIGN);
                rewrite.replace(assignment, newAssignment, null);
            } else if (operator == Assignment.Operator.BIT_OR_ASSIGN) {
                Assignment newAssignment = ast.newAssignment();
                newAssignment.setLeftHandSide(newName);
                newAssignment.setRightHandSide(inversedExpression);
                newAssignment.setOperator(Assignment.Operator.BIT_AND_ASSIGN);
                rewrite.replace(assignment, newAssignment, null);
            } else {
                rewrite.replace(expression, inversedExpression, null);
                // set new name
                rewrite.replace(name, newName, null);
            }
        } else if (location == VariableDeclarationFragment.NAME_PROPERTY) {
            // replace initializer for variable
            VariableDeclarationFragment vdf = (VariableDeclarationFragment) name.getParent();
            Expression expression = vdf.getInitializer();
            if (expression != null) {
                rewrite.replace(expression, getInversedExpression(rewrite, expression), null);
            }
            // set new name
            rewrite.replace(name, newName, null);
        } else if (name.getParent() instanceof PrefixExpression && ((PrefixExpression) name.getParent()).getOperator() == PrefixExpression.Operator.NOT) {
            rewrite.replace(name.getParent(), newName, null);
        } else {
            PrefixExpression expression = ast.newPrefixExpression();
            expression.setOperator(PrefixExpression.Operator.NOT);
            expression.setOperand(newName);
            rewrite.replace(name, expression, null);
        }
    }
    // add correction proposal
    resultingCollections.add(proposal);
    return true;
}
Also used : Operator(org.eclipse.jdt.core.dom.InfixExpression.Operator) AST(org.eclipse.jdt.core.dom.AST) MethodDeclaration(org.eclipse.jdt.core.dom.MethodDeclaration) SimpleName(org.eclipse.jdt.core.dom.SimpleName) IBinding(org.eclipse.jdt.core.dom.IBinding) IVariableBinding(org.eclipse.jdt.core.dom.IVariableBinding) Assignment(org.eclipse.jdt.core.dom.Assignment) 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) LinkedCorrectionProposal(org.eclipse.jdt.internal.ui.text.correction.proposals.LinkedCorrectionProposal) VariableDeclarationFragment(org.eclipse.jdt.core.dom.VariableDeclarationFragment) PrefixExpression(org.eclipse.jdt.core.dom.PrefixExpression) Iterator(java.util.Iterator) ASTRewrite(org.eclipse.jdt.core.dom.rewrite.ASTRewrite) HashSet(java.util.HashSet) StructuralPropertyDescriptor(org.eclipse.jdt.core.dom.StructuralPropertyDescriptor)

Aggregations

Operator (org.eclipse.jdt.core.dom.InfixExpression.Operator)26 InfixExpression (org.eclipse.jdt.core.dom.InfixExpression)18 ASTRewrite (org.eclipse.jdt.core.dom.rewrite.ASTRewrite)13 Expression (org.eclipse.jdt.core.dom.Expression)11 ParenthesizedExpression (org.eclipse.jdt.core.dom.ParenthesizedExpression)9 ASTRewriteCorrectionProposal (org.eclipse.jdt.ui.text.java.correction.ASTRewriteCorrectionProposal)9 AST (org.eclipse.jdt.core.dom.AST)8 ConditionalExpression (org.eclipse.jdt.core.dom.ConditionalExpression)8 InstanceofExpression (org.eclipse.jdt.core.dom.InstanceofExpression)8 PrefixExpression (org.eclipse.jdt.core.dom.PrefixExpression)8 CastExpression (org.eclipse.jdt.core.dom.CastExpression)7 IfStatement (org.eclipse.jdt.core.dom.IfStatement)5 LambdaExpression (org.eclipse.jdt.core.dom.LambdaExpression)5 Statement (org.eclipse.jdt.core.dom.Statement)5 Image (org.eclipse.swt.graphics.Image)4 Iterator (java.util.Iterator)3 AssertStatement (org.eclipse.jdt.core.dom.AssertStatement)3 Block (org.eclipse.jdt.core.dom.Block)3 BreakStatement (org.eclipse.jdt.core.dom.BreakStatement)3 ContinueStatement (org.eclipse.jdt.core.dom.ContinueStatement)3