本文整理汇总了Java中org.eclipse.jdt.core.dom.SimpleType.NAME_PROPERTY属性的典型用法代码示例。如果您正苦于以下问题:Java SimpleType.NAME_PROPERTY属性的具体用法?Java SimpleType.NAME_PROPERTY怎么用?Java SimpleType.NAME_PROPERTY使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.jdt.core.dom.SimpleType
的用法示例。
在下文中一共展示了SimpleType.NAME_PROPERTY属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addEnhancedForWithoutTypeProposals
private static void addEnhancedForWithoutTypeProposals(ICompilationUnit cu, ASTNode selectedNode,
Collection<CUCorrectionProposal> proposals) {
if (selectedNode instanceof SimpleName && (selectedNode.getLocationInParent() == SimpleType.NAME_PROPERTY || selectedNode.getLocationInParent() == NameQualifiedType.NAME_PROPERTY)) {
ASTNode type= selectedNode.getParent();
if (type.getLocationInParent() == SingleVariableDeclaration.TYPE_PROPERTY) {
SingleVariableDeclaration svd= (SingleVariableDeclaration) type.getParent();
if (svd.getLocationInParent() == EnhancedForStatement.PARAMETER_PROPERTY) {
if (svd.getName().getLength() == 0) {
SimpleName simpleName= (SimpleName) selectedNode;
String name= simpleName.getIdentifier();
int relevance= StubUtility.hasLocalVariableName(cu.getJavaProject(), name) ? 10 : 7;
String label= Messages.format(CorrectionMessages.UnresolvedElementsSubProcessor_create_loop_variable_description, BasicElementLabels.getJavaElementName(name));
proposals.add(new NewVariableCorrectionProposal(label, cu, NewVariableCorrectionProposal.LOCAL,
simpleName, null, relevance));
}
}
}
}
}
示例2: guessBindingForTypeReference
public static ITypeBinding guessBindingForTypeReference(ASTNode node) {
StructuralPropertyDescriptor locationInParent= node.getLocationInParent();
if (locationInParent == QualifiedName.QUALIFIER_PROPERTY) {
return null; // can't guess type for X.A
}
if (locationInParent == SimpleType.NAME_PROPERTY ||
locationInParent == NameQualifiedType.NAME_PROPERTY) {
node= node.getParent();
}
ITypeBinding binding= Bindings.normalizeTypeBinding(getPossibleTypeBinding(node));
if (binding != null) {
if (binding.isWildcardType()) {
return normalizeWildcardType(binding, true, node.getAST());
}
}
return binding;
}
示例3: addEnhancedForWithoutTypeProposals
private static void addEnhancedForWithoutTypeProposals(ICompilationUnit cu, ASTNode selectedNode, Collection<ICommandAccess> proposals) {
if (selectedNode instanceof SimpleName && (selectedNode.getLocationInParent() == SimpleType.NAME_PROPERTY || selectedNode.getLocationInParent() == NameQualifiedType.NAME_PROPERTY)) {
ASTNode type= selectedNode.getParent();
if (type.getLocationInParent() == SingleVariableDeclaration.TYPE_PROPERTY) {
SingleVariableDeclaration svd= (SingleVariableDeclaration) type.getParent();
if (svd.getLocationInParent() == EnhancedForStatement.PARAMETER_PROPERTY) {
if (svd.getName().getLength() == 0) {
SimpleName simpleName= (SimpleName) selectedNode;
String name= simpleName.getIdentifier();
int relevance= StubUtility.hasLocalVariableName(cu.getJavaProject(), name) ? 10 : 7;
String label= Messages.format(CorrectionMessages.UnresolvedElementsSubProcessor_create_loop_variable_description, BasicElementLabels.getJavaElementName(name));
Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_LOCAL);
proposals.add(new NewVariableCorrectionProposal(label, cu, NewVariableCorrectionProposal.LOCAL, simpleName, null, relevance, image));
}
}
}
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:UnresolvedElementsSubProcessor.java
示例4: guessBindingForTypeReference
public static ITypeBinding guessBindingForTypeReference(ASTNode node) {
StructuralPropertyDescriptor locationInParent= node.getLocationInParent();
if (locationInParent == QualifiedName.QUALIFIER_PROPERTY) {
return null; // can't guess type for X.A
}
if (locationInParent == SimpleType.NAME_PROPERTY) {
node= node.getParent();
}
ITypeBinding binding= Bindings.normalizeTypeBinding(getPossibleTypeBinding(node));
if (binding != null) {
if (binding.isWildcardType()) {
return normalizeWildcardType(binding, true, node.getAST());
}
}
return binding;
}
示例5: addEnhancedForWithoutTypeProposals
private static void addEnhancedForWithoutTypeProposals(
ICompilationUnit cu, ASTNode selectedNode, Collection<ICommandAccess> proposals) {
if (selectedNode instanceof SimpleName
&& (selectedNode.getLocationInParent() == SimpleType.NAME_PROPERTY
|| selectedNode.getLocationInParent() == NameQualifiedType.NAME_PROPERTY)) {
ASTNode type = selectedNode.getParent();
if (type.getLocationInParent() == SingleVariableDeclaration.TYPE_PROPERTY) {
SingleVariableDeclaration svd = (SingleVariableDeclaration) type.getParent();
if (svd.getLocationInParent() == EnhancedForStatement.PARAMETER_PROPERTY) {
if (svd.getName().getLength() == 0) {
SimpleName simpleName = (SimpleName) selectedNode;
String name = simpleName.getIdentifier();
int relevance = StubUtility.hasLocalVariableName(cu.getJavaProject(), name) ? 10 : 7;
String label =
Messages.format(
CorrectionMessages
.UnresolvedElementsSubProcessor_create_loop_variable_description,
BasicElementLabels.getJavaElementName(name));
Image image = JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_LOCAL);
proposals.add(
new NewVariableCorrectionProposal(
label,
cu,
NewVariableCorrectionProposal.LOCAL,
simpleName,
null,
relevance,
image));
}
}
}
}
}
示例6: getConstructorBindingIfAvailable
/**
* Checks whether the given name belongs to a {@link ClassInstanceCreation} and if so, returns
* its constructor binding.
*
* @param nameNode the name node
* @return the constructor binding or <code>null</code> if not found
* @since 3.7
*/
private IBinding getConstructorBindingIfAvailable(Name nameNode) {
StructuralPropertyDescriptor loc= nameNode.getLocationInParent();
if (loc == SimpleType.NAME_PROPERTY) {
ASTNode parent= nameNode.getParent();
loc= parent.getLocationInParent();
if (loc == ClassInstanceCreation.TYPE_PROPERTY)
return ((ClassInstanceCreation)parent.getParent()).resolveConstructorBinding();
}
return null;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:18,代码来源:CopyQualifiedNameAction.java
示例7: resolveBinding
private static IBinding resolveBinding(ASTNode node) {
if (node instanceof SimpleName) {
// workaround for https://bugs.eclipse.org/62605 (constructor name resolves to type, not method)
SimpleName simpleName= (SimpleName) node;
StructuralPropertyDescriptor loc= simpleName.getLocationInParent();
while (loc == QualifiedType.NAME_PROPERTY || loc == QualifiedName.NAME_PROPERTY|| loc == SimpleType.NAME_PROPERTY || loc == ParameterizedType.TYPE_PROPERTY) {
node= node.getParent();
loc= node.getLocationInParent();
}
if (loc == ClassInstanceCreation.TYPE_PROPERTY) {
ClassInstanceCreation cic= (ClassInstanceCreation) node.getParent();
IMethodBinding constructorBinding= cic.resolveConstructorBinding();
if (constructorBinding == null)
return null;
ITypeBinding declaringClass= constructorBinding.getDeclaringClass();
if (!declaringClass.isAnonymous())
return constructorBinding;
ITypeBinding superTypeDeclaration= declaringClass.getSuperclass().getTypeDeclaration();
return resolveSuperclassConstructor(superTypeDeclaration, constructorBinding);
}
return simpleName.resolveBinding();
} else if (node instanceof SuperConstructorInvocation) {
return ((SuperConstructorInvocation) node).resolveConstructorBinding();
} else if (node instanceof ConstructorInvocation) {
return ((ConstructorInvocation) node).resolveConstructorBinding();
} else {
return null;
}
}