Java 类com.intellij.psi.impl.FreeThreadedFileViewProvider 实例源码

项目:intellij-ce-playground    文件:SmartPsiFileRangePointerImpl.java   
@NotNull
private static SmartPointerElementInfo createElementInfo(@NotNull PsiFile containingFile, @NotNull ProperTextRange range, boolean forInjected) {
  Project project = containingFile.getProject();
  if (containingFile.getViewProvider() instanceof FreeThreadedFileViewProvider) {
    PsiLanguageInjectionHost host = InjectedLanguageManager.getInstance(project).getInjectionHost(containingFile);
    if (host != null) {
      SmartPsiElementPointer<PsiLanguageInjectionHost> hostPointer = SmartPointerManager.getInstance(project).createSmartPsiElementPointer(host);
      return new InjectedSelfElementInfo(project, containingFile, range, containingFile, hostPointer);
    }
  }
  if (range.equals(containingFile.getTextRange())) return new FileElementInfo(containingFile);
  return new SelfElementInfo(project, range, PsiElement.class, containingFile, containingFile.getLanguage(), forInjected);
}
项目:intellij-ce-playground    文件:CompositeElement.java   
private boolean isNonPhysicalOrInjected() {
  FileElement fileElement = TreeUtil.getFileElement(this);
  if (fileElement == null || fileElement instanceof DummyHolderElement) return true;
  if (fileElement.getTreeParent() != null) return true; // dummy holder
  PsiElement wrapper = this instanceof PsiElement ? (PsiElement)this : myWrapper;
  if (wrapper == null) return true;
  PsiFile psiFile = wrapper.getContainingFile();
  return
    psiFile ==  null ||
    psiFile instanceof DummyHolder ||
    psiFile.getViewProvider() instanceof FreeThreadedFileViewProvider ||
    !psiFile.isPhysical();
}
项目:tools-idea    文件:CompositeElement.java   
private boolean isNonPhysicalOrInjected() {
  FileElement fileElement = TreeUtil.getFileElement(this);
  if (fileElement == null || fileElement instanceof DummyHolderElement) return true;
  if (fileElement.getTreeParent() != null) return true; // dummy holder
  PsiElement wrapper = this instanceof PsiElement ? (PsiElement)this : myWrapper;
  if (wrapper == null) return true;
  PsiFile psiFile = wrapper.getContainingFile();
  return
    psiFile ==  null ||
    psiFile instanceof DummyHolder ||
    psiFile.getViewProvider() instanceof FreeThreadedFileViewProvider ||
    !psiFile.isPhysical();
}
项目:consulo    文件:SmartPsiFileRangePointerImpl.java   
@Nonnull
private static SmartPointerElementInfo createElementInfo(@Nonnull PsiFile containingFile, @Nonnull ProperTextRange range, boolean forInjected) {
  Project project = containingFile.getProject();
  if (containingFile.getViewProvider() instanceof FreeThreadedFileViewProvider) {
    PsiLanguageInjectionHost host = InjectedLanguageManager.getInstance(project).getInjectionHost(containingFile);
    if (host != null) {
      SmartPsiElementPointer<PsiLanguageInjectionHost> hostPointer = SmartPointerManager.getInstance(project).createSmartPsiElementPointer(host);
      return new InjectedSelfElementInfo(project, containingFile, range, containingFile, hostPointer);
    }
  }
  if (!forInjected && range.equals(containingFile.getTextRange())) return new FileElementInfo(containingFile);
  return new SelfElementInfo(project, range, Identikit.fromTypes(PsiElement.class, null, LanguageUtil.getRootLanguage(containingFile)), containingFile, forInjected);
}
项目:tools-idea    文件:SmartPsiElementPointerImpl.java   
@NotNull
private static <E extends PsiElement> SmartPointerElementInfo createElementInfo(@NotNull Project project, @NotNull E element, PsiFile containingFile) {
  if (element instanceof PsiCompiledElement || containingFile == null || !containingFile.isPhysical() || !element.isPhysical()) {
    if (element instanceof StubBasedPsiElement && element instanceof PsiCompiledElement) {
      if (element instanceof PsiFile) {
        return new FileElementInfo((PsiFile)element);
      }
      PsiAnchor.StubIndexReference stubReference = PsiAnchor.createStubReference(element, containingFile);
      if (stubReference != null) {
        return new ClsElementInfo(stubReference);
      }
    }
    return new HardElementInfo(project, element);
  }
  if (element instanceof PsiDirectory) {
    return new DirElementInfo((PsiDirectory)element);
  }

  for(SmartPointerElementInfoFactory factory: Extensions.getExtensions(SmartPointerElementInfoFactory.EP_NAME)) {
    final SmartPointerElementInfo result = factory.createElementInfo(element);
    if (result != null) return result;
  }

  FileViewProvider viewProvider = containingFile.getViewProvider();
  if (viewProvider instanceof FreeThreadedFileViewProvider) {
    PsiElement hostContext = InjectedLanguageManager.getInstance(containingFile.getProject()).getInjectionHost(containingFile);
    if (hostContext != null) return new InjectedSelfElementInfo(project, element, hostContext);
  }

  if (element instanceof PsiFile) {
    return new FileElementInfo((PsiFile)element);
  }

  TextRange elementRange = element.getTextRange();
  if (elementRange == null) {
    return new HardElementInfo(project, element);
  }
  ProperTextRange proper = ProperTextRange.create(elementRange);

  return new SelfElementInfo(project, proper, element.getClass(), containingFile, containingFile.getLanguage());
}
项目:consulo    文件:CompositeElement.java   
private static boolean isNonPhysicalOrInjected(@Nonnull PsiFile psiFile) {
  return psiFile instanceof DummyHolder || psiFile.getViewProvider() instanceof FreeThreadedFileViewProvider || !psiFile.isPhysical();
}