當前位置: 首頁>>代碼示例>>Java>>正文


Java Language.findInstancesByMimeType方法代碼示例

本文整理匯總了Java中com.intellij.lang.Language.findInstancesByMimeType方法的典型用法代碼示例。如果您正苦於以下問題:Java Language.findInstancesByMimeType方法的具體用法?Java Language.findInstancesByMimeType怎麽用?Java Language.findInstancesByMimeType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.lang.Language的用法示例。


在下文中一共展示了Language.findInstancesByMimeType方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: findScriptContentProvider

import com.intellij.lang.Language; //導入方法依賴的package包/類
@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;
}
 
開發者ID:LichFaker,項目名稱:RtplPlugin,代碼行數:18,代碼來源:BaseHtmlLexer.java

示例2: getLanguagesToInject

import com.intellij.lang.Language; //導入方法依賴的package包/類
@Override
public void getLanguagesToInject(@NotNull MultiHostRegistrar registrar, @NotNull PsiElement context) {
  if (context instanceof AppleScriptStringLiteralExpression) {
    AppleScriptCommandHandlerCall asCommand = PsiTreeUtil.getContextOfType(context, AppleScriptCommandHandlerCall.class);
    if (asCommand != null && asCommand.getCommandName().equalsIgnoreCase("do javascript")) {
      Collection<Language> javascript = Language.findInstancesByMimeType("javascript");
      if (javascript.isEmpty()) return;

      registrar.startInjecting(javascript.iterator().next()).addPlace(null, null, (PsiLanguageInjectionHost) context, new TextRange(1, context.getTextLength() - 1)).doneInjecting();
    }
  }
}
 
開發者ID:ant-druha,項目名稱:AppleScript-IDEA,代碼行數:13,代碼來源:AppleScriptJSInjector.java

示例3: getLanguage

import com.intellij.lang.Language; //導入方法依賴的package包/類
private static Language getLanguage(String mimeType) {
    Language language = null;
    Collection<Language> langs = Language.findInstancesByMimeType(mimeType);
    if (langs.isEmpty()) {
        language = PlainTextLanguage.INSTANCE;
    } else {
        language = langs.iterator().next();//Pick first one
    }

    return language;
}
 
開發者ID:machaval,項目名稱:mule-intellij-plugins,代碼行數:12,代碼來源:WeaveEditor.java

示例4: getScriptLanguageToInject

import com.intellij.lang.Language; //導入方法依賴的package包/類
/**
 * Finds language to be injected into &lt;script&gt; tag
 *
 * @param xmlTag &lt;script&gt; tag
 * @return language to inject or null if no language found or not a script tag at all
 */
@Nullable
public static Language getScriptLanguageToInject(@NotNull XmlTag xmlTag) {
  if (!HtmlUtil.isScriptTag(xmlTag)) {
    return null;
  }
  String mimeType = xmlTag.getAttributeValue("type");
  Collection<Language> languages = Language.findInstancesByMimeType(mimeType);
  return !languages.isEmpty() ? languages.iterator().next() : Language.ANY;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:16,代碼來源:HtmlScriptLanguageInjector.java

示例5: getScriptLanguage

import com.intellij.lang.Language; //導入方法依賴的package包/類
@Nullable
protected Language getScriptLanguage() {
  Collection<Language> instancesByMimeType = Language.findInstancesByMimeType(scriptType != null ? scriptType.trim() : null);
  return instancesByMimeType.isEmpty() ? null : instancesByMimeType.iterator().next();
}
 
開發者ID:LichFaker,項目名稱:RtplPlugin,代碼行數:6,代碼來源:BaseHtmlLexer.java


注:本文中的com.intellij.lang.Language.findInstancesByMimeType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。