org.eclipse.jdt.core.dom.MethodDeclaration#BODY_PROPERTY源码实例Demo

下面列出了org.eclipse.jdt.core.dom.MethodDeclaration#BODY_PROPERTY 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: eclipse.jdt.ls   文件: ExtractTempRefactoring.java
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;
}
 
源代码2 项目: eclipse.jdt.ls   文件: ExtractFieldRefactoring.java
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;
}
 
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;
}
 
源代码4 项目: eclipse.jdt.ls   文件: DelegateMethodCreator.java
@Override
protected ChildPropertyDescriptor getBodyProperty() {
	return MethodDeclaration.BODY_PROPERTY;
}
 
@Override
protected ChildPropertyDescriptor getBodyProperty() {
	return MethodDeclaration.BODY_PROPERTY;
}