private Object[] getApplicableAttributeVariants(PsiElement _context) { if (_context instanceof XmlTokenImpl && ((XmlTokenImpl)_context).getTokenType() == XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN) { XmlAttribute attr = PsiTreeUtil.getParentOfType(_context, XmlAttribute.class); if (attr != null) { final XmlAttributeDescriptor descriptor = attr.getDescriptor(); if (descriptor != null) { if (descriptor.isFixed()) { final String defaultValue = descriptor.getDefaultValue(); return defaultValue == null ? ArrayUtil.EMPTY_OBJECT_ARRAY : new Object[]{defaultValue}; } String[] values = getEnumeratedValues(attr); final String[] strings = addSpecificCompletions(attr); if (values == null || values.length == 0) { values = strings; } else if (strings != null) { values = ArrayUtil.mergeArrays(values, strings); } return values == null ? ArrayUtil.EMPTY_OBJECT_ARRAY : values; } } } return ArrayUtil.EMPTY_OBJECT_ARRAY; }
@NotNull @Override public LeafElement createLeaf(@NotNull IElementType type, @NotNull LanguageVersion languageVersion, @NotNull CharSequence text) { if (type instanceof IXmlLeafElementType) { if (type == XML_REAL_WHITE_SPACE) { return new PsiWhiteSpaceImpl(text); } return new XmlTokenImpl(type, text); } return null; }