Search in sources :

Example 1 with AttributeChildDescriptionImpl

use of com.intellij.util.xml.impl.AttributeChildDescriptionImpl in project intellij-community by JetBrains.

the class AbstractDomChildrenDescriptor method getAttributesDescriptors.

@Override
public XmlAttributeDescriptor[] getAttributesDescriptors(@Nullable final XmlTag context) {
    if (context == null)
        return XmlAttributeDescriptor.EMPTY;
    DomElement domElement = myManager.getDomElement(context);
    if (domElement == null)
        return XmlAttributeDescriptor.EMPTY;
    final List<? extends DomAttributeChildDescription> descriptions = domElement.getGenericInfo().getAttributeChildrenDescriptions();
    List<XmlAttributeDescriptor> descriptors = new ArrayList<>();
    for (DomAttributeChildDescription description : descriptions) {
        descriptors.add(new DomAttributeXmlDescriptor(description, myManager.getProject()));
    }
    List<? extends CustomDomChildrenDescription> customs = domElement.getGenericInfo().getCustomNameChildrenDescription();
    for (CustomDomChildrenDescription custom : customs) {
        CustomDomChildrenDescription.AttributeDescriptor descriptor = custom.getCustomAttributeDescriptor();
        if (descriptor != null) {
            for (EvaluatedXmlName variant : descriptor.getCompletionVariants(domElement)) {
                AttributeChildDescriptionImpl childDescription = new AttributeChildDescriptionImpl(variant.getXmlName(), String.class);
                descriptors.add(new DomAttributeXmlDescriptor(childDescription, myManager.getProject()));
            }
        }
    }
    return descriptors.toArray(new XmlAttributeDescriptor[descriptors.size()]);
}
Also used : DomElement(com.intellij.util.xml.DomElement) EvaluatedXmlName(com.intellij.util.xml.EvaluatedXmlName) XmlAttributeDescriptor(com.intellij.xml.XmlAttributeDescriptor) ArrayList(java.util.ArrayList) AttributeChildDescriptionImpl(com.intellij.util.xml.impl.AttributeChildDescriptionImpl)

Aggregations

DomElement (com.intellij.util.xml.DomElement)1 EvaluatedXmlName (com.intellij.util.xml.EvaluatedXmlName)1 AttributeChildDescriptionImpl (com.intellij.util.xml.impl.AttributeChildDescriptionImpl)1 XmlAttributeDescriptor (com.intellij.xml.XmlAttributeDescriptor)1 ArrayList (java.util.ArrayList)1