本文整理汇总了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;
}
示例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;*/
}
示例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();
}
示例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);
}
};
}
示例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;
}
示例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;
}