public static ASTNode getEnclosingNode(ASTNode firstSelectedNode) { ASTNode enclosingNode; if (firstSelectedNode instanceof MethodReference) { enclosingNode= firstSelectedNode; } else { enclosingNode= ASTResolving.findEnclosingLambdaExpression(firstSelectedNode); if (enclosingNode != null) { enclosingNode= ((LambdaExpression) enclosingNode).getBody(); } else { enclosingNode= ASTNodes.getParent(firstSelectedNode, BodyDeclaration.class); } } return enclosingNode; }
} else { Block body= null; LambdaExpression enclosingLambdaExpr= ASTResolving.findEnclosingLambdaExpression(getFirstSelectedNode()); if (enclosingLambdaExpr != null) { ASTNode lambdaBody= enclosingLambdaExpr.getBody();
private static ITypeBinding getTargetTypeForReturnStmt(ReturnStatement returnStmt) { LambdaExpression enclosingLambdaExpr= ASTResolving.findEnclosingLambdaExpression(returnStmt); if (enclosingLambdaExpr != null) { IMethodBinding methodBinding= enclosingLambdaExpr.resolveMethodBinding(); return methodBinding == null ? null : methodBinding.getReturnType(); } MethodDeclaration enclosingMethodDecl= ASTResolving.findParentMethodDeclaration(returnStmt); if (enclosingMethodDecl != null) { IMethodBinding methodBinding= enclosingMethodDecl.resolveBinding(); return methodBinding == null ? null : methodBinding.getReturnType(); } return null; }
private boolean isVoidMethod() { ITypeBinding binding= null; LambdaExpression enclosingLambdaExpr= ASTResolving.findEnclosingLambdaExpression(getFirstSelectedNode()); if (enclosingLambdaExpr != null) { IMethodBinding methodBinding= enclosingLambdaExpr.resolveMethodBinding(); if (methodBinding != null) { binding= methodBinding.getReturnType(); } } else { // if we have an initializer if (fEnclosingMethodBinding == null) return true; binding= fEnclosingMethodBinding.getReturnType(); } if (fEnclosingBodyDeclaration.getAST().resolveWellKnownType("void").equals(binding)) //$NON-NLS-1$ return true; return false; }
LambdaExpression enclosingLambda= ASTResolving.findEnclosingLambdaExpression(ifStatement); if (enclosingLambda != null) { IMethodBinding lambdaMethodBinding= enclosingLambda.resolveMethodBinding();
LambdaExpression enclosingLambda= ASTResolving.findEnclosingLambdaExpression(selectedNode); if (enclosingLambda != null && selectedNode.getLocationInParent() == LambdaExpression.BODY_PROPERTY && enclosingLambda.resolveMethodBinding() != null) { QuickAssistProcessor.changeLambdaBodyToBlock(enclosingLambda, getAST(), fRewriter);
LambdaExpression enclosingLambdaExpr= ASTResolving.findEnclosingLambdaExpression(getFirstSelectedNode()); if (enclosingLambdaExpr != null) { fReturnType= ASTNodeFactory.newReturnType(enclosingLambdaExpr, ast, rewriter, null);
return decl.getReturnType2().resolveBinding(); LambdaExpression lambdaExpr= ASTResolving.findEnclosingLambdaExpression(parent); if (lambdaExpr != null) { IMethodBinding lambdaMethodBinding= lambdaExpr.resolveMethodBinding();