本文整理汇总了Java中com.intellij.spi.psi.SPIFile类的典型用法代码示例。如果您正苦于以下问题:Java SPIFile类的具体用法?Java SPIFile怎么用?Java SPIFile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SPIFile类属于com.intellij.spi.psi包,在下文中一共展示了SPIFile类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: annotate
import com.intellij.spi.psi.SPIFile; //导入依赖的package包/类
@Override
public void annotate(@NotNull PsiElement element, @NotNull AnnotationHolder holder) {
final VirtualFile file = PsiUtilCore.getVirtualFile(element);
if (file != null) {
final String serviceProviderName = file.getName();
final PsiClass psiClass =
ClassUtil.findPsiClass(element.getManager(), serviceProviderName, null, true, element.getContainingFile().getResolveScope());
if (element instanceof SPIFile) {
if (psiClass == null) {
holder.createErrorAnnotation(element, "No service provider \"" + serviceProviderName + "\' found").setFileLevelAnnotation(true);
}
} else if (element instanceof SPIClassProviderReferenceElement) {
final PsiElement resolve = ((SPIClassProviderReferenceElement)element).resolve();
if (resolve == null) {
holder.createErrorAnnotation(element, "Cannot resolve symbol " + element.getText());
} else if (resolve instanceof PsiClass && psiClass != null) {
if (!((PsiClass)resolve).isInheritor(psiClass, true)) {
holder.createErrorAnnotation(element, "Registered extension should implement " + serviceProviderName);
}
}
}
}
}
示例2: createFile
import com.intellij.spi.psi.SPIFile; //导入依赖的package包/类
@Override
public PsiFile createFile(FileViewProvider viewProvider) {
return new SPIFile(viewProvider);
}