当前位置: 首页>>代码示例>>Java>>正文


Java PsiUtilCore.getTemplateLanguageFile方法代码示例

本文整理汇总了Java中com.intellij.psi.util.PsiUtilCore.getTemplateLanguageFile方法的典型用法代码示例。如果您正苦于以下问题:Java PsiUtilCore.getTemplateLanguageFile方法的具体用法?Java PsiUtilCore.getTemplateLanguageFile怎么用?Java PsiUtilCore.getTemplateLanguageFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.psi.util.PsiUtilCore的用法示例。


在下文中一共展示了PsiUtilCore.getTemplateLanguageFile方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isValidForFile

import com.intellij.psi.util.PsiUtilCore; //导入方法依赖的package包/类
@Override
protected boolean isValidForFile(@NotNull Project project, @NotNull Editor editor, @NotNull final PsiFile file) {
  final Language language = file.getLanguage();
  if (!LanguageSurrounders.INSTANCE.allForLanguage(language).isEmpty()) {
    return true;
  }
  final PsiFile baseFile = PsiUtilCore.getTemplateLanguageFile(file);
  if (baseFile != null && baseFile != file && !LanguageSurrounders.INSTANCE.allForLanguage(baseFile.getLanguage()).isEmpty()) {
    return true;
  }

  if (!TemplateManagerImpl.listApplicableTemplateWithInsertingDummyIdentifier(editor, file, true).isEmpty()) {
    return true;
  }

  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:SurroundWithAction.java

示例2: getJspFile

import com.intellij.psi.util.PsiUtilCore; //导入方法依赖的package包/类
@Nullable
public static JspFile getJspFile(final PsiElement element) {
  final PsiFile psiFile = PsiUtilCore.getTemplateLanguageFile(element);
  return psiFile instanceof JspFile ? (JspFile)psiFile : null;

  /*final FileViewProvider provider = element.getContainingFile().getViewProvider();
  PsiFile file = provider.getPsi(StdLanguages.JSP);
  if (file instanceof JspFile) return (JspFile)file;
  file = provider.getPsi(StdLanguages.JSPX);
  return file instanceof JspFile ? (JspFile)file : null;*/
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:JspPsiUtil.java

示例3: MultiHostRegistrarImpl

import com.intellij.psi.util.PsiUtilCore; //导入方法依赖的package包/类
MultiHostRegistrarImpl(@NotNull Project project,
                       @NotNull PsiFile hostPsiFile,
                       @NotNull PsiElement contextElement) {
  myProject = project;
  myContextElement = contextElement;
  myHostPsiFile = PsiUtilCore.getTemplateLanguageFile(hostPsiFile);
  myPsiManager = myHostPsiFile.getManager();
  cleared = true;
  FileViewProvider viewProvider = myHostPsiFile.getViewProvider();
  myHostVirtualFile = viewProvider.getVirtualFile();
  myHostDocument = (DocumentEx)viewProvider.getDocument();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:MultiHostRegistrarImpl.java

示例4: buildVisitor

import com.intellij.psi.util.PsiUtilCore; //导入方法依赖的package包/类
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, final boolean isOnTheFly) {
  return new XmlElementVisitor() {
    @Override
    public void visitXmlAttributeValue(final XmlAttributeValue value) {
      if (value.getTextRange().isEmpty()) {
        return;
      }
      final PsiFile file = value.getContainingFile();
      if (!(file instanceof XmlFile)) {
        return;
      }
      PsiFile baseFile = PsiUtilCore.getTemplateLanguageFile(file);
      if (baseFile != file && !(baseFile instanceof XmlFile)) {
        return;
      }
      final XmlRefCountHolder refHolder = XmlRefCountHolder.getRefCountHolder((XmlFile)file);
      if (refHolder == null) return;

      final PsiElement parent = value.getParent();
      if (!(parent instanceof XmlAttribute)) return;

      final XmlTag tag = (XmlTag)parent.getParent();
      if (tag == null) return;

      checkValue(value, (XmlFile)file, refHolder, tag, holder);
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:XmlDuplicatedIdInspection.java

示例5: getServerPageFile

import com.intellij.psi.util.PsiUtilCore; //导入方法依赖的package包/类
@Nullable public static ServerPageFile getServerPageFile(final PsiElement element) {
  final PsiFile psiFile = PsiUtilCore.getTemplateLanguageFile(element);
  return psiFile instanceof ServerPageFile ? (ServerPageFile)psiFile : null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:PsiImplUtil.java

示例6: getJspFile

import com.intellij.psi.util.PsiUtilCore; //导入方法依赖的package包/类
private static ServerPageFile getJspFile(PsiClass psiClass) {
  final PsiFile psiFile = PsiUtilCore.getTemplateLanguageFile(psiClass);
  return psiFile instanceof ServerPageFile ? (ServerPageFile)psiFile : null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:RefClassImpl.java


注:本文中的com.intellij.psi.util.PsiUtilCore.getTemplateLanguageFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。