Java Code Examples for org.eclipse.jdt.core.dom.MethodDeclaration#BODY_PROPERTY
The following examples show how to use
org.eclipse.jdt.core.dom.MethodDeclaration#BODY_PROPERTY .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExtractTempRefactoring.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 6 votes |
private ASTNode getEnclosingBodyNode() throws JavaModelException { ASTNode node = getSelectedExpression().getAssociatedNode(); // expression must be in a method, lambda or initializer body // make sure it is not in method or parameter annotation StructuralPropertyDescriptor location = null; while (node != null && !(node instanceof BodyDeclaration)) { location = node.getLocationInParent(); node = node.getParent(); if (node instanceof LambdaExpression) { break; } } if (location == MethodDeclaration.BODY_PROPERTY || location == Initializer.BODY_PROPERTY || (location == LambdaExpression.BODY_PROPERTY && ((LambdaExpression) node).resolveMethodBinding() != null)) { return (ASTNode) node.getStructuralProperty(location); } return null; }
Example 2
Source File: ExtractFieldRefactoring.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 6 votes |
private ASTNode getEnclosingBodyNode() throws JavaModelException { ASTNode node = getSelectedExpression().getAssociatedNode(); // expression must be in a method, lambda or initializer body. // make sure it is not in method or parameter annotation StructuralPropertyDescriptor location = null; while (node != null && !(node instanceof BodyDeclaration)) { location = node.getLocationInParent(); node = node.getParent(); if (node instanceof LambdaExpression) { break; } } if (location == MethodDeclaration.BODY_PROPERTY || location == Initializer.BODY_PROPERTY || (location == LambdaExpression.BODY_PROPERTY && ((LambdaExpression) node).resolveMethodBinding() != null)) { return (ASTNode) node.getStructuralProperty(location); } return null; }
Example 3
Source File: ExtractTempRefactoring.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private Block getEnclosingBodyNode() throws JavaModelException { ASTNode node= getSelectedExpression().getAssociatedNode(); // expression must be in a method or initializer body // make sure it is not in method or parameter annotation StructuralPropertyDescriptor location= null; while (node != null && !(node instanceof BodyDeclaration)) { location= node.getLocationInParent(); node= node.getParent(); } if (location == MethodDeclaration.BODY_PROPERTY || location == Initializer.BODY_PROPERTY) { return (Block) node.getStructuralProperty(location); } return null; }
Example 4
Source File: DelegateMethodCreator.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 4 votes |
@Override protected ChildPropertyDescriptor getBodyProperty() { return MethodDeclaration.BODY_PROPERTY; }
Example 5
Source File: DelegateMethodCreator.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
@Override protected ChildPropertyDescriptor getBodyProperty() { return MethodDeclaration.BODY_PROPERTY; }