Java 类com.intellij.lang.xhtml.XHTMLLanguage 实例源码

项目:intellij-ce-playground    文件:XmlCoreEnvironment.java   
public ApplicationEnvironment(CoreApplicationEnvironment appEnvironment) {
  appEnvironment.registerFileType(HtmlFileType.INSTANCE, "html;htm;sht;shtm;shtml");
  appEnvironment.registerFileType(XHtmlFileType.INSTANCE, "xhtml");
  appEnvironment.registerFileType(DTDFileType.INSTANCE, "dtd;ent;mod;elt");

  appEnvironment.registerFileType(XmlFileType.INSTANCE, "xml;xsd;tld;xsl;jnlp;wsdl;jhm;ant;xul;xslt;rng;fxml");

  SyntaxHighlighterFactory.LANGUAGE_FACTORY.addExplicitExtension(XMLLanguage.INSTANCE, new XmlSyntaxHighlighterFactory());
  SyntaxHighlighterFactory.LANGUAGE_FACTORY.addExplicitExtension(DTDLanguage.INSTANCE, new DtdSyntaxHighlighterFactory());
  SyntaxHighlighterFactory.LANGUAGE_FACTORY.addExplicitExtension(HTMLLanguage.INSTANCE, new HtmlSyntaxHighlighterFactory());
  SyntaxHighlighterFactory.LANGUAGE_FACTORY.addExplicitExtension(XHTMLLanguage.INSTANCE, new XhtmlSyntaxHighlighterFactory());

  appEnvironment.addExplicitExtension(LanguageParserDefinitions.INSTANCE, XMLLanguage.INSTANCE, new XMLParserDefinition());
  appEnvironment.addExplicitExtension(LanguageParserDefinitions.INSTANCE, DTDLanguage.INSTANCE, new DTDParserDefinition());
  appEnvironment.addExplicitExtension(LanguageParserDefinitions.INSTANCE, HTMLLanguage.INSTANCE, new HTMLParserDefinition());
  appEnvironment.addExplicitExtension(LanguageParserDefinitions.INSTANCE, XHTMLLanguage.INSTANCE, new XHTMLParserDefinition());

  appEnvironment.addExplicitExtension(IdIndexers.INSTANCE, XmlFileType.INSTANCE, new XmlIdIndexer());
  appEnvironment.addExplicitExtension(IdIndexers.INSTANCE, DTDFileType.INSTANCE, new XmlIdIndexer());
  appEnvironment.addExplicitExtension(TodoIndexers.INSTANCE, XmlFileType.INSTANCE, new XmlTodoIndexer());
  appEnvironment.addExplicitExtension(TodoIndexers.INSTANCE, DTDFileType.INSTANCE, new XmlTodoIndexer());
  appEnvironment.addExplicitExtension(TodoIndexers.INSTANCE, XHtmlFileType.INSTANCE, new XHtmlTodoIndexer());

  appEnvironment.addExtension(MetaDataContributor.EP_NAME, new XmlApplicationComponent());
  appEnvironment.addExtension(FileBasedIndexExtension.EXTENSION_POINT_NAME, new XmlNamespaceIndex());
  appEnvironment.addExtension(FileBasedIndexExtension.EXTENSION_POINT_NAME, new SchemaTypeInheritanceIndex());
  appEnvironment.addExtension(FileBasedIndexExtension.EXTENSION_POINT_NAME, new XmlTagNamesIndex());
  appEnvironment.addExtension(StandardResourceProvider.EP_NAME, new InternalResourceProvider());

  appEnvironment.registerApplicationComponent(PathMacros.class, new PathMacrosImpl());
  appEnvironment.registerApplicationService(ExternalResourceManager.class, new ExternalResourceManagerExImpl());
  appEnvironment.registerApplicationService(XmlFoldingSettings.class, new XmlFoldingSettings());
  Language[] myLanguages = new Language[]{XMLLanguage.INSTANCE, HTMLLanguage.INSTANCE, XHTMLLanguage.INSTANCE, DTDLanguage.INSTANCE};
  for (Language myLanguage : myLanguages) {
    appEnvironment.addExplicitExtension(LanguageFolding.INSTANCE, myLanguage, new XmlFoldingBuilder());
    appEnvironment.addExplicitExtension(LanguageFindUsages.INSTANCE, myLanguage, new XmlFindUsagesProvider());
    appEnvironment.addExplicitExtension(LanguageASTFactory.INSTANCE, myLanguage, new XmlASTFactory());
  }
}
项目:intellij-ce-playground    文件:HtmlUtil.java   
public static boolean isHtmlTagContainingFile(PsiElement element) {
  if (element == null) {
    return false;
  }
  final PsiFile containingFile = element.getContainingFile();
  if (containingFile != null) {
    final XmlTag tag = PsiTreeUtil.getParentOfType(element, XmlTag.class, false);
    if (tag instanceof HtmlTag) {
      return true;
    }
    final XmlDocument document = PsiTreeUtil.getParentOfType(element, XmlDocument.class, false);
    if (document instanceof HtmlDocumentImpl) {
      return true;
    }
    final FileViewProvider provider = containingFile.getViewProvider();
    Language language;
    if (provider instanceof TemplateLanguageFileViewProvider) {
      language = ((TemplateLanguageFileViewProvider)provider).getTemplateDataLanguage();
    }
    else {
      language = provider.getBaseLanguage();
    }

    return language == XHTMLLanguage.INSTANCE;
  }
  return false;
}
项目:intellij-ce-playground    文件:HtmlGotoRelatedProvider.java   
private static boolean isAvailable(@NotNull PsiFile psiFile) {
  for (PsiFile file : psiFile.getViewProvider().getAllFiles()) {
    Language language = file.getLanguage();
    if (language.isKindOf(HTMLLanguage.INSTANCE) || language.isKindOf(XHTMLLanguage.INSTANCE)) {
      return true;
    }
  }
  return false;
}
项目:intellij-ce-playground    文件:XmlSplitTagAction.java   
private static boolean isInsideUnsplittableElement(final PsiElement grandParent) {
  if (!(grandParent instanceof HtmlTag) && grandParent.getContainingFile().getLanguage() != XHTMLLanguage.INSTANCE) {
    return false;
  }

  final String name = ((XmlTag)grandParent).getName();
  return "html".equals(name) || "body".equals(name) || "title".equals(name);
}
项目:intellij-ce-playground    文件:XmlDocumentationProvider.java   
static String generateHtmlAdditionalDocTemplate(@NotNull PsiElement element) {
  StringBuilder buf = new StringBuilder();
  final PsiFile containingFile = element.getContainingFile();
  if (containingFile != null) {
    final XmlTag tag = PsiTreeUtil.getParentOfType(element, XmlTag.class, false);
    boolean append;
    if (tag instanceof HtmlTag) {
      append = true;
    }
    else {
      final FileViewProvider provider = containingFile.getViewProvider();
      Language language;
      if (provider instanceof TemplateLanguageFileViewProvider) {
        language = ((TemplateLanguageFileViewProvider)provider).getTemplateDataLanguage();
      }
      else {
        language = provider.getBaseLanguage();
      }

      append = language == XHTMLLanguage.INSTANCE;
    }

    if (tag != null) {
      EntityDescriptor descriptor = HtmlDescriptorsTable.getTagDescriptor(tag.getName());
      if (descriptor != null && append) {
        buf.append("<br>");
        buf.append(XmlBundle.message("html.quickdoc.additional.template",
                                     descriptor.getHelpRef(),
                                     BASE_SITEPOINT_URL + tag.getName()));
      }
    }
  }

  return buf.toString();
}
项目:intellij-ce-playground    文件:DtdReferencesProvider.java   
private static boolean canHaveAdequateFix(PsiElement element) {
  final PsiFile containingFile = element.getContainingFile();

  if (containingFile.getLanguage() == HTMLLanguage.INSTANCE ||
      containingFile.getLanguage() == XHTMLLanguage.INSTANCE ||
      containingFile.getViewProvider() instanceof TemplateLanguageFileViewProvider
    ) {
    return false;
  }
  return true;
}
项目:intellij-ce-playground    文件:Html5CustomAttributesIndex.java   
@Override
@NotNull
public Map<String, Void> map(@NotNull FileContent inputData) {
  CharSequence input = inputData.getContentAsText();
  Language language = ((LanguageFileType)inputData.getFileType()).getLanguage();
  if (language == HTMLLanguage.INSTANCE || language == XHTMLLanguage.INSTANCE) {
    final Lexer lexer = (language == HTMLLanguage.INSTANCE ? new HtmlHighlightingLexer(FileTypeManager.getInstance().getStdFileType("CSS")) : new XHtmlHighlightingLexer());
    lexer.start(input);
    Map<String, Void> result = new HashMap<String, Void>();
    IElementType tokenType = lexer.getTokenType();
    while (tokenType != null) {
      if (tokenType == XmlTokenType.XML_NAME) {
        String xmlName = input.subSequence(lexer.getTokenStart(), lexer.getTokenEnd()).toString();
        if (HtmlUtil.isCustomHtml5Attribute(xmlName)) {
          result.put(xmlName, null);
        }
      }
      else if (tokenType == XmlTokenType.XML_DOCTYPE_PUBLIC || tokenType == XmlTokenType.XML_DOCTYPE_SYSTEM) {
        // this is not an HTML5 context
        break;
      }
      lexer.advance();
      tokenType = lexer.getTokenType();
    }
    return result;
  }
  return Collections.emptyMap();
}
项目:tools-idea    文件:XmlCoreEnvironment.java   
public ApplicationEnvironment(CoreApplicationEnvironment appEnvironment) {
  appEnvironment.registerFileType(HtmlFileType.INSTANCE, "html;htm;sht;shtm;shtml");
  appEnvironment.registerFileType(XHtmlFileType.INSTANCE, "xhtml");
  appEnvironment.registerFileType(DTDFileType.INSTANCE, "dtd;ent;mod;elt");

  appEnvironment.registerFileType(XmlFileType.INSTANCE, "xml;xsd;tld;xsl;jnlp;wsdl;jhm;ant;xul;xslt;rng;fxml");

  appEnvironment.addExplicitExtension(LanguageParserDefinitions.INSTANCE, XMLLanguage.INSTANCE, new XMLParserDefinition());
  appEnvironment.addExplicitExtension(LanguageParserDefinitions.INSTANCE, DTDLanguage.INSTANCE, new DTDParserDefinition());
  appEnvironment.addExplicitExtension(LanguageParserDefinitions.INSTANCE, HTMLLanguage.INSTANCE, new HTMLParserDefinition());
  appEnvironment.addExplicitExtension(LanguageParserDefinitions.INSTANCE, XHTMLLanguage.INSTANCE, new XHTMLParserDefinition());

  XmlASTFactory astFactory = new XmlASTFactory();
  appEnvironment.addExplicitExtension(LanguageASTFactory.INSTANCE, XMLLanguage.INSTANCE, astFactory);
  appEnvironment.addExplicitExtension(LanguageASTFactory.INSTANCE, HTMLLanguage.INSTANCE, astFactory);
  appEnvironment.addExplicitExtension(LanguageASTFactory.INSTANCE, XHTMLLanguage.INSTANCE, astFactory);
  appEnvironment.addExplicitExtension(LanguageASTFactory.INSTANCE, DTDLanguage.INSTANCE, astFactory);

  appEnvironment.addExplicitExtension(IdIndexers.INSTANCE, XmlFileType.INSTANCE, new XmlIdIndexer());
  appEnvironment.addExplicitExtension(IdIndexers.INSTANCE, DTDFileType.INSTANCE, new XmlIdIndexer());

  CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), StartTagEndTokenProvider.EP_NAME, StartTagEndTokenProvider.class);
  CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), XmlSuppressionProvider.EP_NAME, XmlSuppressionProvider.class);
  CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), XmlFileNSInfoProvider.EP_NAME, XmlFileNSInfoProvider.class);
  CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), XmlSchemaProvider.EP_NAME, XmlSchemaProvider.class);
  CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ImplicitNamespaceDescriptorProvider.EP_NAME, ImplicitNamespaceDescriptorProvider.class);
  CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), XmlElementDescriptorProvider.EP_NAME, XmlElementDescriptorProvider.class);
  CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), Html5SchemaProvider.EP_NAME, Html5SchemaProvider.class);
  CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), XmlAttributeDescriptorsProvider.EP_NAME, XmlAttributeDescriptorsProvider.class);
  CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), XmlExtension.EP_NAME, XmlExtension.class);
  CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), HtmlEmbeddedTokenTypesProvider.EXTENSION_POINT_NAME, HtmlEmbeddedTokenTypesProvider.class);
  CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), StandardResourceProvider.EP_NAME, StandardResourceProvider.class);
  CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), StandardResourceEP.EP_NAME, StandardResourceEP.class);

  appEnvironment.addExtension(MetaDataContributor.EP_NAME, new XmlApplicationComponent());
  appEnvironment.addExtension(FileBasedIndexExtension.EXTENSION_POINT_NAME, new XmlNamespaceIndex());
  appEnvironment.addExtension(StandardResourceProvider.EP_NAME, new InternalResourceProvider());

  appEnvironment.registerApplicationService(ExternalResourceManager.class, createExternalResourceManager());
}
项目:tools-idea    文件:HtmlUtil.java   
public static boolean isHtmlTagContainingFile(PsiElement element) {
  if (element == null) {
    return false;
  }
  final PsiFile containingFile = element.getContainingFile();
  if (containingFile != null) {
    final XmlTag tag = PsiTreeUtil.getParentOfType(element, XmlTag.class, false);
    if (tag instanceof HtmlTag) {
      return true;
    }
    final XmlDocument document = PsiTreeUtil.getParentOfType(element, XmlDocument.class, false);
    if (document instanceof HtmlDocumentImpl) {
      return true;
    }
    final FileViewProvider provider = containingFile.getViewProvider();
    Language language;
    if (provider instanceof TemplateLanguageFileViewProvider) {
      language = ((TemplateLanguageFileViewProvider)provider).getTemplateDataLanguage();
    }
    else {
      language = provider.getBaseLanguage();
    }

    return language == XHTMLLanguage.INSTANCE;
  }
  return false;
}
项目:tools-idea    文件:HtmlGotoRelatedProvider.java   
private static boolean isAvailable(@NotNull PsiFile psiFile) {
  for (PsiFile file : psiFile.getViewProvider().getAllFiles()) {
    Language language = file.getLanguage();
    if (language.isKindOf(HTMLLanguage.INSTANCE) || language.isKindOf(XHTMLLanguage.INSTANCE)) {
      return true;
    }
  }
  return false;
}
项目:tools-idea    文件:XmlSplitTagAction.java   
private static boolean isInsideUnsplittableElement(final PsiElement grandParent) {
  if (!(grandParent instanceof HtmlTag) && grandParent.getContainingFile().getLanguage() != XHTMLLanguage.INSTANCE) {
    return false;
  }

  final String name = ((XmlTag)grandParent).getName();
  return "html".equals(name) || "body".equals(name) || "title".equals(name);
}
项目:tools-idea    文件:XmlDocumentationProvider.java   
static String generateHtmlAdditionalDocTemplate(@NotNull PsiElement element) {
  StringBuilder buf = new StringBuilder();
  final PsiFile containingFile = element.getContainingFile();
  if (containingFile != null) {
    final XmlTag tag = PsiTreeUtil.getParentOfType(element, XmlTag.class, false);
    boolean append;
    if (tag instanceof HtmlTag) {
      append = true;
    }
    else {
      final FileViewProvider provider = containingFile.getViewProvider();
      Language language;
      if (provider instanceof TemplateLanguageFileViewProvider) {
        language = ((TemplateLanguageFileViewProvider)provider).getTemplateDataLanguage();
      }
      else {
        language = provider.getBaseLanguage();
      }

      append = language == XHTMLLanguage.INSTANCE;
    }

    if (tag != null) {
      EntityDescriptor descriptor = HtmlDescriptorsTable.getTagDescriptor(tag.getName());
      if (descriptor != null && append) {
        buf.append("<br>");
        buf.append(XmlBundle.message("html.quickdoc.additional.template",
                                     descriptor.getHelpRef(),
                                     BASE_SITEPOINT_URL + tag.getName()));
      }
    }
  }

  return buf.toString();
}
项目:tools-idea    文件:DtdReferencesProvider.java   
private static boolean canHaveAdequateFix(PsiElement element) {
  final PsiFile containingFile = element.getContainingFile();

  if (containingFile.getLanguage() == HTMLLanguage.INSTANCE ||
      containingFile.getLanguage() == XHTMLLanguage.INSTANCE ||
      containingFile.getViewProvider() instanceof TemplateLanguageFileViewProvider
    ) {
    return false;
  }
  return true;
}
项目:tools-idea    文件:Html5CustomAttributesIndex.java   
@Override
@NotNull
public Map<String, Void> map(FileContent inputData) {
  CharSequence input = inputData.getContentAsText();
  Language language = ((LanguageFileType)inputData.getFileType()).getLanguage();
  if (language == HTMLLanguage.INSTANCE || language == XHTMLLanguage.INSTANCE) {
    final Lexer lexer = (language == HTMLLanguage.INSTANCE ? new HtmlHighlightingLexer() : new XHtmlHighlightingLexer());
    lexer.start(input);
    Map<String, Void> result = new HashMap<String, Void>();
    IElementType tokenType = lexer.getTokenType();
    while (tokenType != null) {
      if (tokenType == XmlTokenType.XML_NAME) {
        String xmlName = input.subSequence(lexer.getTokenStart(), lexer.getTokenEnd()).toString();
        if (HtmlUtil.isCustomHtml5Attribute(xmlName)) {
          result.put(xmlName, null);
        }
      }
      else if (tokenType == XmlTokenType.XML_DOCTYPE_PUBLIC || tokenType == XmlTokenType.XML_DOCTYPE_SYSTEM) {
        // this is not an HTML5 context
        break;
      }
      lexer.advance();
      tokenType = lexer.getTokenType();
    }
    return result;
  }
  return Collections.emptyMap();
}
项目:consulo-xml    文件:HtmlUtil.java   
public static boolean isHtmlTagContainingFile(PsiElement element)
{
    if(element == null)
    {
        return false;
    }
    final PsiFile containingFile = element.getContainingFile();
    if(containingFile != null)
    {
        final XmlTag tag = PsiTreeUtil.getParentOfType(element, XmlTag.class, false);
        if(tag instanceof HtmlTag)
        {
            return true;
        }
        final XmlDocument document = PsiTreeUtil.getParentOfType(element, XmlDocument.class, false);
        if(document instanceof HtmlDocumentImpl)
        {
            return true;
        }
        final FileViewProvider provider = containingFile.getViewProvider();
        Language language;
        if(provider instanceof TemplateLanguageFileViewProvider)
        {
            language = ((TemplateLanguageFileViewProvider) provider).getTemplateDataLanguage();
        }
        else
        {
            language = provider.getBaseLanguage();
        }

        return language == XHTMLLanguage.INSTANCE;
    }
    return false;
}
项目:consulo-xml    文件:HtmlCompletionContributor.java   
private static boolean hasHtmlAttributesCompletion(PsiElement position)
{
    if(PsiTreeUtil.getParentOfType(position, HtmlTag.class, false) != null)
    {
        return true;
    }
    XmlTag xmlTag = PsiTreeUtil.getParentOfType(position, XmlTag.class, false);
    return xmlTag != null && xmlTag.getLanguage() == XHTMLLanguage.INSTANCE;
}
项目:consulo-xml    文件:HtmlGotoRelatedProvider.java   
private static boolean isAvailable(@NotNull PsiFile psiFile) {
  for (PsiFile file : psiFile.getViewProvider().getAllFiles()) {
    Language language = file.getLanguage();
    if (language.isKindOf(HTMLLanguage.INSTANCE) || language.isKindOf(XHTMLLanguage.INSTANCE)) {
      return true;
    }
  }
  return false;
}
项目:consulo-xml    文件:XmlSplitTagAction.java   
private static boolean isInsideUnsplittableElement(final PsiElement grandParent) {
  if (!(grandParent instanceof HtmlTag) && grandParent.getContainingFile().getLanguage() != XHTMLLanguage.INSTANCE) {
    return false;
  }

  final String name = ((XmlTag)grandParent).getName();
  return "html".equals(name) || "body".equals(name) || "title".equals(name);
}
项目:consulo-xml    文件:XmlDocumentationProvider.java   
static String generateHtmlAdditionalDocTemplate(@NotNull PsiElement element) {
  StringBuilder buf = new StringBuilder();
  final PsiFile containingFile = element.getContainingFile();
  if (containingFile != null) {
    final XmlTag tag = PsiTreeUtil.getParentOfType(element, XmlTag.class, false);
    boolean append;
    if (tag instanceof HtmlTag) {
      append = true;
    }
    else {
      final FileViewProvider provider = containingFile.getViewProvider();
      Language language;
      if (provider instanceof TemplateLanguageFileViewProvider) {
        language = ((TemplateLanguageFileViewProvider)provider).getTemplateDataLanguage();
      }
      else {
        language = provider.getBaseLanguage();
      }

      append = language == XHTMLLanguage.INSTANCE;
    }

    if (tag != null) {
      EntityDescriptor descriptor = HtmlDescriptorsTable.getTagDescriptor(tag.getName());
      if (descriptor != null && append) {
        buf.append("<br>");
        buf.append(XmlBundle.message("html.quickdoc.additional.template",
                                     descriptor.getHelpRef(),
                                     BASE_SITEPOINT_URL + tag.getName()));
      }
    }
  }

  return buf.toString();
}
项目:consulo-xml    文件:AbstractXmlBlock.java   
protected boolean useMyFormatter(final Language myLanguage, final Language childLanguage, final PsiElement childPsi) {
  if (myLanguage == childLanguage ||
      childLanguage == HTMLLanguage.INSTANCE ||
      childLanguage == XHTMLLanguage.INSTANCE ||
      childLanguage == XMLLanguage.INSTANCE) {
    return true;
  }
  final FormattingModelBuilder childFormatter = LanguageFormatting.INSTANCE.forLanguage(childLanguage);
  return childFormatter == null ||
         childFormatter instanceof DelegatingFormattingModelBuilder &&
         ((DelegatingFormattingModelBuilder)childFormatter).dontFormatMyModel();
}
项目:consulo-xml    文件:DtdReferencesProvider.java   
private static boolean canHaveAdequateFix(PsiElement element)
{
    final PsiFile containingFile = element.getContainingFile();

    if(containingFile.getLanguage() == HTMLLanguage.INSTANCE || containingFile.getLanguage() == XHTMLLanguage.INSTANCE || containingFile.getViewProvider() instanceof
            TemplateLanguageFileViewProvider)
    {
        return false;
    }
    return true;
}
项目:consulo-xml    文件:Html5CustomAttributesIndex.java   
@Override
@NotNull
public Map<String, Void> map(FileContent inputData) {
  CharSequence input = inputData.getContentAsText();
  Language language = ((LanguageFileType)inputData.getFileType()).getLanguage();
  if (language == HTMLLanguage.INSTANCE || language == XHTMLLanguage.INSTANCE) {
    final Lexer lexer = (language == HTMLLanguage.INSTANCE ? new HtmlHighlightingLexer() : new XHtmlHighlightingLexer());
    lexer.start(input);
    Map<String, Void> result = new HashMap<String, Void>();
    IElementType tokenType = lexer.getTokenType();
    while (tokenType != null) {
      if (tokenType == XmlTokenType.XML_NAME) {
        String xmlName = input.subSequence(lexer.getTokenStart(), lexer.getTokenEnd()).toString();
        if (HtmlUtil.isCustomHtml5Attribute(xmlName)) {
          result.put(xmlName, null);
        }
      }
      else if (tokenType == XmlTokenType.XML_DOCTYPE_PUBLIC || tokenType == XmlTokenType.XML_DOCTYPE_SYSTEM) {
        // this is not an HTML5 context
        break;
      }
      lexer.advance();
      tokenType = lexer.getTokenType();
    }
    return result;
  }
  return Collections.emptyMap();
}
项目:intellij-ce-playground    文件:WebBrowserService.java   
public static boolean isHtmlOrXmlFile(@NotNull Language language) {
  return language == HTMLLanguage.INSTANCE || language == XHTMLLanguage.INSTANCE || language == XMLLanguage.INSTANCE;
}
项目:intellij-ce-playground    文件:XmlUtil.java   
@Nullable
@NonNls
public static String[][] getDefaultNamespaces(final XmlDocument document) {
  final XmlFile file = getContainingFile(document);

  final XmlTag tag = document.getRootTag();
  if (tag == null) return null;

  @NotNull final XmlFileNSInfoProvider[] nsProviders = Extensions.getExtensions(XmlFileNSInfoProvider.EP_NAME);
  if (file != null) {

    NextProvider:
    for (XmlFileNSInfoProvider nsProvider : nsProviders) {
      final String[][] pairs = nsProvider.getDefaultNamespaces(file);
      if (pairs != null && pairs.length > 0) {

        for (final String[] nsMapping : pairs) {
          if (nsMapping == null || nsMapping.length != 2 || nsMapping[0] == null || nsMapping[1] == null) {
            LOG.debug("NSInfoProvider " + nsProvider + " gave wrong info about " + file.getVirtualFile());
            continue NextProvider;
          }
        }
        return pairs;
      }
    }
  }

  String namespace = getDtdUri(document);

  if (namespace != null) {
    boolean overrideNamespaceFromDocType = false;

    if (file != null) {
      for (XmlFileNSInfoProvider provider : nsProviders) {
        try {
          if (provider.overrideNamespaceFromDocType(file)) {
            overrideNamespaceFromDocType = true;
            break;
          }
        }
        catch (AbstractMethodError ignored) {
        }
      }
    }

    if (!overrideNamespaceFromDocType) return new String[][]{new String[]{"", namespace}};
  }

  if ("taglib".equals(tag.getName())) {
    return new String[][]{new String[]{"", TAGLIB_1_2_URI}};
  }

  if (file != null) {

    final Language language = file.getLanguage();
    if (language == HTMLLanguage.INSTANCE || language == XHTMLLanguage.INSTANCE) {
      return new String[][]{new String[]{"", XHTML_URI}};
    }
  }

  return null;
}
项目:intellij-ce-playground    文件:HtmlUtil.java   
public static boolean isHtmlFile(@NotNull PsiElement element) {
  Language language = element.getLanguage();
  return language == HTMLLanguage.INSTANCE || language == XHTMLLanguage.INSTANCE;
}
项目:intellij-ce-playground    文件:XmlFileImpl.java   
private boolean isWebFileType() {
  return getLanguage() == XHTMLLanguage.INSTANCE || getLanguage() == HTMLLanguage.INSTANCE;
}
项目:intellij-ce-playground    文件:XHtmlFileType.java   
private XHtmlFileType() {
  super(XHTMLLanguage.INSTANCE);
}
项目:intellij-ce-playground    文件:HtmlContextType.java   
static boolean isMyLanguage(Language language) {
  return language.isKindOf(HTMLLanguage.INSTANCE) || language.isKindOf(XHTMLLanguage.INSTANCE);
}
项目:intellij-ce-playground    文件:XmlLanguageBreadcrumbsInfoProvider.java   
@Override
public Language[] getLanguages() {
  return new Language[]{XMLLanguage.INSTANCE, XHTMLLanguage.INSTANCE, HTMLLanguage.INSTANCE};
}
项目:tools-idea    文件:XmlUtil.java   
@Nullable
@NonNls
public static String[][] getDefaultNamespaces(final XmlDocument document) {
  final XmlFile file = getContainingFile(document);

  final XmlTag tag = document.getRootTag();
  if (tag == null) return null;

  @NotNull final XmlFileNSInfoProvider[] nsProviders = Extensions.getExtensions(XmlFileNSInfoProvider.EP_NAME);
  if (file != null) {

    NextProvider:
    for (XmlFileNSInfoProvider nsProvider : nsProviders) {
      final String[][] pairs = nsProvider.getDefaultNamespaces(file);
      if (pairs != null && pairs.length > 0) {

        for (final String[] nsMapping : pairs) {
          if (nsMapping == null || nsMapping.length != 2 || nsMapping[0] == null || nsMapping[1] == null) {
            LOG.debug("NSInfoProvider " + nsProvider + " gave wrong info about " + file.getVirtualFile());
            continue NextProvider;
          }
        }
        return pairs;
      }
    }
  }

  String namespace = getDtdUri(document);

  if (namespace != null) {
    boolean overrideNamespaceFromDocType = false;

    if (file != null) {
      for (XmlFileNSInfoProvider provider : nsProviders) {
        try {
          if (provider.overrideNamespaceFromDocType(file)) {
            overrideNamespaceFromDocType = true;
            break;
          }
        }
        catch (AbstractMethodError ignored) {
        }
      }
    }

    if (!overrideNamespaceFromDocType) return new String[][]{new String[]{"", namespace}};
  }

  if ("taglib".equals(tag.getName())) {
    return new String[][]{new String[]{"", TAGLIB_1_2_URI}};
  }

  if (file != null) {

    final Language language = file.getLanguage();
    if (language == HTMLLanguage.INSTANCE || language == XHTMLLanguage.INSTANCE) {
      return new String[][]{new String[]{"", XHTML_URI}};
    }
  }

  return null;
}
项目:tools-idea    文件:HtmlUtil.java   
public static boolean isHtmlFile(@NotNull PsiElement element) {
  Language language = element.getLanguage();
  return language == HTMLLanguage.INSTANCE || language == XHTMLLanguage.INSTANCE;
}
项目:tools-idea    文件:XmlFileImpl.java   
private boolean isWebFileType() {
  return getLanguage() == XHTMLLanguage.INSTANCE || getLanguage() == HTMLLanguage.INSTANCE;
}
项目:tools-idea    文件:XHtmlFileType.java   
private XHtmlFileType() {
  super(XHTMLLanguage.INSTANCE);
}
项目:tools-idea    文件:HtmlContextType.java   
static boolean isMyLanguage(Language language) {
  return language.isKindOf(HTMLLanguage.INSTANCE) || language.isKindOf(XHTMLLanguage.INSTANCE);
}
项目:tools-idea    文件:XmlLanguageBreadcrumbsInfoProvider.java   
public Language[] getLanguages() {
  return new Language[]{XMLLanguage.INSTANCE, XHTMLLanguage.INSTANCE, HTMLLanguage.INSTANCE};
}
项目:consulo-xml    文件:HtmlUtil.java   
public static boolean isHtmlFile(@NotNull PsiElement element)
{
    Language language = element.getLanguage();
    return language.isKindOf(HTMLLanguage.INSTANCE) || language == XHTMLLanguage.INSTANCE;
}
项目:consulo-xml    文件:XmlFileImpl.java   
private boolean isWebFileType()
{
    return getLanguage() == XHTMLLanguage.INSTANCE || getLanguage() == HTMLLanguage.INSTANCE;
}
项目:consulo-xml    文件:XHtmlFileType.java   
private XHtmlFileType() {
  super(XHTMLLanguage.INSTANCE);
}
项目:consulo-xml    文件:HtmlContextType.java   
static boolean isMyLanguage(Language language) {
  return language.isKindOf(HTMLLanguage.INSTANCE) || language.isKindOf(XHTMLLanguage.INSTANCE);
}
项目:consulo-xml    文件:XHtmlLanguageBreadcrumbsInfoProvider.java   
@NotNull
@Override
public Language getLanguage()
{
    return XHTMLLanguage.INSTANCE;
}