use of org.jetbrains.android.dom.converters.AttributeValueDocumentationProvider in project android by JetBrains.
the class AndroidXmlDocumentationProvider method getDocumentationElementForLookupItem.
@Override
public PsiElement getDocumentationElementForLookupItem(PsiManager psiManager, Object object, PsiElement element) {
if (object instanceof ResourceReferenceConverter.DocumentationHolder) {
final ResourceReferenceConverter.DocumentationHolder holder = (ResourceReferenceConverter.DocumentationHolder) object;
return new ProvidedDocumentationPsiElement(psiManager, Language.ANY, holder.getValue(), holder.getDocumentation());
}
if (!(element instanceof XmlAttributeValue) || !(object instanceof String)) {
return null;
}
final String value = (String) object;
final PsiElement parent = element.getParent();
if (!(parent instanceof XmlAttribute)) {
return null;
}
final GenericAttributeValue domValue = DomManager.getDomManager(parent.getProject()).getDomElement((XmlAttribute) parent);
if (domValue == null) {
return null;
}
final Converter converter = domValue.getConverter();
if (converter instanceof AttributeValueDocumentationProvider) {
final String doc = ((AttributeValueDocumentationProvider) converter).getDocumentation(value);
if (doc != null) {
return new MyDocElement(element, doc);
}
}
if ((value.startsWith(PREFIX_RESOURCE_REF) || value.startsWith(PREFIX_THEME_REF)) && !DataBindingUtil.isBindingExpression(value)) {
return new MyResourceElement(element, value);
}
return null;
}
Aggregations