Java 类com.intellij.psi.impl.source.xml.XmlTokenImpl 实例源码

项目:intellij-ce-playground    文件:XmlAttributeValueGetter.java   
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;
}
项目:tools-idea    文件:XmlAttributeValueGetter.java   
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;
}
项目:consulo-xml    文件:XmlASTLeafFactory.java   
@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;
}