Java 类com.intellij.lang.HtmlScriptContentProvider 实例源码

项目:RtplPlugin    文件:BaseHtmlLexer.java   
@Nullable
protected static HtmlScriptContentProvider findScriptContentProvider(@Nullable String mimeType) {
  if (StringUtil.isEmpty(mimeType)) {
    return ourDefaultLanguage != null ? LanguageHtmlScriptContentProvider.getScriptContentProvider(ourDefaultLanguage) : null;
  }
  Collection<Language> instancesByMimeType = Language.findInstancesByMimeType(mimeType.trim());
  if (instancesByMimeType.isEmpty() && mimeType.contains("template")) {
    instancesByMimeType = Collections.<Language>singletonList(HTMLLanguage.INSTANCE);
  }
  for (Language language : instancesByMimeType) {
    HtmlScriptContentProvider scriptContentProvider = LanguageHtmlScriptContentProvider.getScriptContentProvider(language);
    if (scriptContentProvider != null) {
      return scriptContentProvider;
    }
  }
  return null;
}
项目:intellij-ce-playground    文件:BaseHtmlLexer.java   
@Nullable
protected static HtmlScriptContentProvider findScriptContentProvider(@Nullable String mimeType) {
  if (StringUtil.isEmpty(mimeType)) {
    return ourDefaultLanguage != null ? LanguageHtmlScriptContentProvider.getScriptContentProvider(ourDefaultLanguage) : null;
  }
  Collection<Language> instancesByMimeType = Language.findInstancesByMimeType(mimeType.trim());
  if (instancesByMimeType.isEmpty() && mimeType.contains("template")) {
    instancesByMimeType = Collections.<Language>singletonList(HTMLLanguage.INSTANCE);
  }
  for (Language language : instancesByMimeType) {
    HtmlScriptContentProvider scriptContentProvider = LanguageHtmlScriptContentProvider.getScriptContentProvider(language);
    if (scriptContentProvider != null) {
      return scriptContentProvider;
    }
  }
  return null;
}
项目:consulo-xml    文件:BaseHtmlLexer.java   
@Nullable
protected HtmlScriptContentProvider findScriptContentProvider(@Nullable String mimeType)
{
    if(StringUtil.isEmpty(mimeType))
    {
        return ourDefaultLanguage != null ? LanguageHtmlScriptContentProvider.getScriptContentProvider(ourDefaultLanguage) : null;
    }
    Collection<Language> instancesByMimeType = Language.findInstancesByMimeType(mimeType.trim());
    if(instancesByMimeType.isEmpty() && mimeType.contains("template"))
    {
        instancesByMimeType = Collections.singletonList(HTMLLanguage.INSTANCE);
    }
    for(Language language : instancesByMimeType)
    {
        HtmlScriptContentProvider scriptContentProvider = LanguageHtmlScriptContentProvider.getScriptContentProvider(language);
        if(scriptContentProvider != null)
        {
            return scriptContentProvider;
        }
    }
    return null;
}
项目:tools-idea    文件:BaseHtmlLexer.java   
@Nullable
protected static HtmlScriptContentProvider findScriptContentProvider(@Nullable String mimeType) {
  if (StringUtil.isEmpty(mimeType)) {
    return ourDefaultLanguage != null ? LanguageHtmlScriptContentProvider.getScriptContentProvider(ourDefaultLanguage) : null;
  }
  Collection<Language> instancesByMimeType = Language.findInstancesByMimeType(mimeType != null ? mimeType.trim() : null);
  for (Language language : instancesByMimeType) {
    HtmlScriptContentProvider scriptContentProvider = LanguageHtmlScriptContentProvider.getScriptContentProvider(language);
    if (scriptContentProvider != null) {
      return scriptContentProvider;
    }
  }
  return null;
}
项目:RtplPlugin    文件:BaseHtmlLexer.java   
@Nullable
protected IElementType getCurrentScriptElementType() {
  HtmlScriptContentProvider scriptContentProvider = findScriptContentProvider(scriptType);
  return scriptContentProvider == null ? null : scriptContentProvider.getScriptElementType();
}
项目:intellij-ce-playground    文件:BaseHtmlLexer.java   
@Nullable
protected IElementType getCurrentScriptElementType() {
  HtmlScriptContentProvider scriptContentProvider = findScriptContentProvider(scriptType);
  return scriptContentProvider == null ? null : scriptContentProvider.getScriptElementType();
}
项目:intellij-ce-playground    文件:HtmlHighlightingLexer.java   
private void setEmbeddedLexer() {
  Lexer newLexer = null;
  if (hasSeenStyle()) {
    if (styleLexer == null) {
      if (ourStyleFileType == null) {
        styleLexer = null;
      }
      else {
        SyntaxHighlighter highlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(ourStyleFileType, null, null);
        LOG.assertTrue(highlighter != null, ourStyleFileType);
        styleLexer = highlighter.getHighlightingLexer();
      }
    }

    newLexer = styleLexer;
  }
  else if (hasSeenScript()) {
    Lexer scriptLexer = scriptLexers.get(scriptType);
    if (scriptLexer == null) {
      if (hasSeenTag()) {
        HtmlScriptContentProvider provider = findScriptContentProvider(scriptType);
        if (provider != null) {
          scriptLexer = provider.getHighlightingLexer();
        }
        else {
          scriptLexer = SyntaxHighlighterFactory.getSyntaxHighlighter(PlainTextLanguage.INSTANCE, null, null).getHighlightingLexer();
        }
      }
      else if (hasSeenAttribute()) {
        SyntaxHighlighter syntaxHighlighter =
          ourInlineScriptFileType != null ? SyntaxHighlighterFactory.getSyntaxHighlighter(ourInlineScriptFileType, null, null) : null;
        scriptLexer = syntaxHighlighter != null ? syntaxHighlighter.getHighlightingLexer() : null;
      }
      scriptLexers.put(scriptType, scriptLexer);
    }
    newLexer = scriptLexer;
  }
  else {
    newLexer = createELLexer(newLexer);
  }

  if (newLexer != null) {
    embeddedLexer = newLexer;
  }
}
项目:tools-idea    文件:BaseHtmlLexer.java   
@Nullable
protected IElementType getCurrentScriptElementType() {
  HtmlScriptContentProvider scriptContentProvider = findScriptContentProvider(scriptType);
  return scriptContentProvider == null ? null : scriptContentProvider.getScriptElementType();
}
项目:consulo-xml    文件:BaseHtmlLexer.java   
@Nullable
protected IElementType getCurrentScriptElementType()
{
    HtmlScriptContentProvider scriptContentProvider = findScriptContentProvider(scriptType);
    return scriptContentProvider == null ? null : scriptContentProvider.getScriptElementType();
}