Search in sources :

Example 1 with BasicXmlAttributeDescriptor

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

the class XmlAttributeValueGetter method getEnumeratedValues.

@NotNull
public static String[] getEnumeratedValues(XmlAttribute attribute) {
    final XmlAttributeDescriptor descriptor = attribute.getDescriptor();
    if (descriptor == null) {
        return ArrayUtil.EMPTY_STRING_ARRAY;
    }
    String[] result;
    if (descriptor instanceof BasicXmlAttributeDescriptor) {
        result = ((BasicXmlAttributeDescriptor) descriptor).getEnumeratedValues(attribute);
    } else if (descriptor instanceof XmlEnumerationDescriptor) {
        result = ((XmlEnumerationDescriptor) descriptor).getValuesForCompletion();
    } else {
        result = descriptor.getEnumeratedValues();
    }
    return result != null ? StringUtil.filterEmptyStrings(result) : ArrayUtil.EMPTY_STRING_ARRAY;
}
Also used : XmlEnumerationDescriptor(com.intellij.xml.impl.XmlEnumerationDescriptor) BasicXmlAttributeDescriptor(com.intellij.xml.impl.BasicXmlAttributeDescriptor) XmlAttributeDescriptor(com.intellij.xml.XmlAttributeDescriptor) BasicXmlAttributeDescriptor(com.intellij.xml.impl.BasicXmlAttributeDescriptor) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

XmlAttributeDescriptor (com.intellij.xml.XmlAttributeDescriptor)1 BasicXmlAttributeDescriptor (com.intellij.xml.impl.BasicXmlAttributeDescriptor)1 XmlEnumerationDescriptor (com.intellij.xml.impl.XmlEnumerationDescriptor)1 NotNull (org.jetbrains.annotations.NotNull)1