Java 类com.intellij.psi.templateLanguages.TemplateDataElementType 实例源码

项目:idea-doT    文件:DotFileViewProvider.java   
@Override
protected PsiFile createFile(@NotNull Language lang) {
    ParserDefinition parserDefinition = LanguageParserDefinitions.INSTANCE.forLanguage(lang);
    if (parserDefinition == null) {
        return null;
    }

    Language templateDataLanguage = getTemplateDataLanguage(myManager, myFile);
    if (lang == templateDataLanguage) {
        PsiFileImpl file = (PsiFileImpl) parserDefinition.createFile(this);
        file.setContentElementType(new TemplateDataElementType("Dot_TEMPLATE_DATA", templateDataLanguage, DotTokenTypes.CONTENT, DotTokenTypes.OUTER_ELEMENT_TYPE));
        return file;
    } else if (lang == DotLanguage.INSTANCE) {
        return parserDefinition.createFile(this);
    } else {
        return null;
    }
}
项目:consulo-xml    文件:XmlASTLazyFactory.java   
@NotNull
@Override
public LazyParseableElement createLazy(ILazyParseableElementType type, CharSequence text) {
  if (type == XML_FILE) {
    return new XmlFileElement(type, text);
  }
  else if (type == DTD_FILE) {
    return new XmlFileElement(type, text);
  }
  else if (type == XHTML_FILE) {
    return new XmlFileElement(type, text);
  }
  else if (type == HTML_FILE) {
    return new HtmlFileElement(text);
  }
  else if (type instanceof TemplateDataElementType) {
    return new XmlFileElement(type, text);
  }
  return null;
}
项目:consulo-xml    文件:XmlASTCompositeFactory.java   
@Override
public boolean apply(@Nullable IElementType input) {
  return input == XML_TAG ||
         input == XML_CONDITIONAL_SECTION ||
         input == HTML_TAG ||
         input == XML_TEXT ||
         input == XML_PROCESSING_INSTRUCTION ||
         input == XML_DOCUMENT ||
         input == HTML_DOCUMENT ||
         input == XML_PROLOG ||
         input == XML_DECL ||
         input == XML_ATTRIBUTE ||
         input == XML_ATTRIBUTE_VALUE ||
         input == XML_COMMENT ||
         input == XML_DOCTYPE ||
         input == XML_MARKUP_DECL ||
         input == XML_ELEMENT_DECL ||
         input == XML_ENTITY_DECL ||
         input == XML_ATTLIST_DECL ||
         input == XML_ATTRIBUTE_DECL ||
         input == XML_NOTATION_DECL ||
         input == XML_ELEMENT_CONTENT_SPEC ||
         input == XML_ELEMENT_CONTENT_GROUP ||
         input == XML_ENTITY_REF ||
         input == XML_ENUMERATED_TYPE ||
         input == XML_CDATA ||
         input instanceof TemplateDataElementType;
}
项目:consulo-xml    文件:XmlASTLazyFactory.java   
@Override
public boolean apply(@Nullable IElementType input) {
  return input == XML_FILE || input == DTD_FILE || input == XHTML_FILE || input == HTML_FILE || input instanceof TemplateDataElementType;
}
项目:consulo-xml    文件:XmlASTCompositeFactory.java   
@NotNull
@Override
public CompositeElement createComposite(IElementType type) {
  if (type == XML_TAG) {
    return new XmlTagImpl();
  }
  else if (type == XML_CONDITIONAL_SECTION) {
    return new XmlConditionalSectionImpl();
  }
  else if (type == HTML_TAG) {
    return new HtmlTagImpl();
  }
  else if (type == XML_TEXT) {
    return new XmlTextImpl();
  }
  else if (type == XML_PROCESSING_INSTRUCTION) {
    return new XmlProcessingInstructionImpl();
  }
  else if (type == XML_DOCUMENT) {
    return new XmlDocumentImpl();
  }
  else if (type == HTML_DOCUMENT) {
    return new HtmlDocumentImpl();
  }
  else if (type == XML_PROLOG) {
    return new XmlPrologImpl();
  }
  else if (type == XML_DECL) {
    return new XmlDeclImpl();
  }
  else if (type == XML_ATTRIBUTE) {
    return new XmlAttributeImpl();
  }
  else if (type == XML_ATTRIBUTE_VALUE) {
    return new XmlAttributeValueImpl();
  }
  else if (type == XML_COMMENT) {
    return new XmlCommentImpl();
  }
  else if (type == XML_DOCTYPE) {
    return new XmlDoctypeImpl();
  }
  else if (type == XML_MARKUP_DECL) {
    return new XmlMarkupDeclImpl();
  }
  else if (type == XML_ELEMENT_DECL) {
    return new XmlElementDeclImpl();
  }
  else if (type == XML_ENTITY_DECL) {
    return new XmlEntityDeclImpl();
  }
  else if (type == XML_ATTLIST_DECL) {
    return new XmlAttlistDeclImpl();
  }
  else if (type == XML_ATTRIBUTE_DECL) {
    return new XmlAttributeDeclImpl();
  }
  else if (type == XML_NOTATION_DECL) {
    return new XmlNotationDeclImpl();
  }
  else if (type == XML_ELEMENT_CONTENT_SPEC) {
    return new XmlElementContentSpecImpl();
  }
  else if (type == XML_ELEMENT_CONTENT_GROUP) {
    return new XmlElementContentGroupImpl();
  }
  else if (type == XML_ENTITY_REF) {
    return new XmlEntityRefImpl();
  }
  else if (type == XML_ENUMERATED_TYPE) {
    return new XmlEnumeratedTypeImpl();
  }
  else if (type == XML_CDATA) {
    return new CompositePsiElement(XML_CDATA) {};
  }
  else if (type instanceof TemplateDataElementType) {
    return new XmlFileElement(type, null);
  }

  return null;
}