下面列出了org.eclipse.jdt.core.dom.QualifiedName#QUALIFIER_PROPERTY 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
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;
}
public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks) {
ITextEditor textEditor= (ITextEditor)getAdapter(ITextEditor.class);
if (region == null || textEditor == null)
return null;
IEditorSite site= textEditor.getEditorSite();
if (site == null)
return null;
ITypeRoot javaElement= getInputJavaElement(textEditor);
if (javaElement == null)
return null;
CompilationUnit ast= SharedASTProvider.getAST(javaElement, SharedASTProvider.WAIT_NO, null);
if (ast == null)
return null;
ASTNode node= NodeFinder.perform(ast, region.getOffset(), 1);
if (!(node instanceof StringLiteral) && !(node instanceof SimpleName))
return null;
if (node.getLocationInParent() == QualifiedName.QUALIFIER_PROPERTY)
return null;
IRegion nlsKeyRegion= new Region(node.getStartPosition(), node.getLength());
AccessorClassReference ref= NLSHintHelper.getAccessorClassReference(ast, nlsKeyRegion);
if (ref == null)
return null;
String keyName= null;
if (node instanceof StringLiteral) {
keyName= ((StringLiteral)node).getLiteralValue();
} else {
keyName= ((SimpleName)node).getIdentifier();
}
if (keyName != null)
return new IHyperlink[] {new NLSKeyHyperlink(nlsKeyRegion, keyName, ref, textEditor)};
return null;
}