本文整理匯總了Java中org.eclipse.jdt.core.dom.VariableDeclarationFragment.NAME_PROPERTY屬性的典型用法代碼示例。如果您正苦於以下問題:Java VariableDeclarationFragment.NAME_PROPERTY屬性的具體用法?Java VariableDeclarationFragment.NAME_PROPERTY怎麽用?Java VariableDeclarationFragment.NAME_PROPERTY使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.eclipse.jdt.core.dom.VariableDeclarationFragment
的用法示例。
在下文中一共展示了VariableDeclarationFragment.NAME_PROPERTY屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: handleSimpleName
private void handleSimpleName(SimpleName node) {
ASTNode firstExpression = node.getParent();
if (firstExpression instanceof FieldAccess) {
while (firstExpression instanceof FieldAccess) {
firstExpression = ((FieldAccess) firstExpression).getExpression();
}
if (!(firstExpression instanceof SimpleName)) return;
node = (SimpleName) firstExpression;
} else if (firstExpression instanceof SuperFieldAccess) return;
StructuralPropertyDescriptor parentDescription = node.getLocationInParent();
if (parentDescription == VariableDeclarationFragment.NAME_PROPERTY
|| parentDescription == SwitchCase.EXPRESSION_PROPERTY) return;
IBinding binding = node.resolveBinding();
if (!(binding instanceof IVariableBinding)) return;
handleVariable(node, (IVariableBinding) binding);
}
示例2: getDeclaringNode
private static ASTNode getDeclaringNode(ASTNode selectedNode) {
ASTNode declaringNode = null;
if (selectedNode instanceof MethodDeclaration) {
declaringNode = selectedNode;
} else if (selectedNode instanceof SimpleName) {
StructuralPropertyDescriptor locationInParent = selectedNode.getLocationInParent();
if (locationInParent == MethodDeclaration.NAME_PROPERTY
|| locationInParent == TypeDeclaration.NAME_PROPERTY) {
declaringNode = selectedNode.getParent();
} else if (locationInParent == VariableDeclarationFragment.NAME_PROPERTY) {
declaringNode = selectedNode.getParent().getParent();
}
}
return declaringNode;
}
示例3: visit
@Override
public boolean visit(SimpleName node) {
addReferencesToName(node);
IBinding binding = node.resolveBinding();
if (binding instanceof ITypeBinding) {
ITypeBinding type = (ITypeBinding) binding;
if (type.isTypeVariable()) {
addTypeVariableReference(type, node);
}
} else if (binding instanceof IVariableBinding) {
IVariableBinding vb = (IVariableBinding) binding;
if (vb.isField() && !isStaticallyImported(node)) {
Name topName = ASTNodes.getTopMostName(node);
if (node == topName || node == ASTNodes.getLeftMostSimpleName(topName)) {
StructuralPropertyDescriptor location = node.getLocationInParent();
if (location != SingleVariableDeclaration.NAME_PROPERTY
&& location != VariableDeclarationFragment.NAME_PROPERTY) {
fImplicitReceivers.add(node);
}
}
} else if (!vb.isField()) {
// we have a local. Check if it is a parameter.
ParameterData data = fParameters.get(binding);
if (data != null) {
ASTNode parent = node.getParent();
if (parent instanceof Expression) {
int precedence = OperatorPrecedence.getExpressionPrecedence((Expression) parent);
if (precedence != Integer.MAX_VALUE) {
data.setOperatorPrecedence(precedence);
}
}
}
}
}
return true;
}
示例4: consumes
@Override
public boolean consumes(SemanticToken token) {
SimpleName node = token.getNode();
StructuralPropertyDescriptor location = node.getLocationInParent();
if (location == VariableDeclarationFragment.NAME_PROPERTY
|| location == SingleVariableDeclaration.NAME_PROPERTY) {
ASTNode parent = node.getParent();
if (parent instanceof VariableDeclaration) {
parent = parent.getParent();
return parent == null || !(parent instanceof FieldDeclaration);
}
}
return false;
}