Search in sources :

Example 6 with IASTFragment

use of org.eclipse.jdt.ls.core.internal.corext.dom.fragments.IASTFragment in project eclipse.jdt.ls by eclipse.

the class ExtractTempRefactoring method checkMatchingFragments.

private RefactoringStatus checkMatchingFragments() throws JavaModelException {
    RefactoringStatus result = new RefactoringStatus();
    IASTFragment[] matchingFragments = getMatchingFragments();
    for (int i = 0; i < matchingFragments.length; i++) {
        ASTNode node = matchingFragments[i].getAssociatedNode();
        if (isLeftValue(node) && !isReferringToLocalVariableFromFor((Expression) node)) {
            String msg = RefactoringCoreMessages.ExtractTempRefactoring_assigned_to;
            result.addWarning(msg, JavaStatusContext.create(fCu, node));
        }
    }
    return result;
}
Also used : IASTFragment(org.eclipse.jdt.ls.core.internal.corext.dom.fragments.IASTFragment) ASTNode(org.eclipse.jdt.core.dom.ASTNode) RefactoringStatus(org.eclipse.ltk.core.refactoring.RefactoringStatus)

Aggregations

IASTFragment (org.eclipse.jdt.ls.core.internal.corext.dom.fragments.IASTFragment)6 ASTNode (org.eclipse.jdt.core.dom.ASTNode)4 CastExpression (org.eclipse.jdt.core.dom.CastExpression)2 Expression (org.eclipse.jdt.core.dom.Expression)2 LambdaExpression (org.eclipse.jdt.core.dom.LambdaExpression)2 ParenthesizedExpression (org.eclipse.jdt.core.dom.ParenthesizedExpression)2 PostfixExpression (org.eclipse.jdt.core.dom.PostfixExpression)2 PrefixExpression (org.eclipse.jdt.core.dom.PrefixExpression)2 SimpleName (org.eclipse.jdt.core.dom.SimpleName)2 VariableDeclarationExpression (org.eclipse.jdt.core.dom.VariableDeclarationExpression)2 ASTRewrite (org.eclipse.jdt.core.dom.rewrite.ASTRewrite)2 TextEditGroup (org.eclipse.text.edits.TextEditGroup)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 SourceRange (org.eclipse.jdt.core.SourceRange)1 AST (org.eclipse.jdt.core.dom.AST)1 Assignment (org.eclipse.jdt.core.dom.Assignment)1 Block (org.eclipse.jdt.core.dom.Block)1 ExpressionStatement (org.eclipse.jdt.core.dom.ExpressionStatement)1 Name (org.eclipse.jdt.core.dom.Name)1