@Nullable protected PsiFile createFile(@NotNull Project project, @NotNull VirtualFile file, @NotNull FileType fileType) { if (fileType.isBinary() || file.is(VFileProperty.SPECIAL)) { return new PsiBinaryFileImpl((PsiManagerImpl)getManager(), this); } if (!isTooLargeForIntelligence(file)) { final PsiFile psiFile = createFile(getBaseLanguage()); if (psiFile != null) return psiFile; } if (isTooLargeForContentLoading(file)) { return new PsiLargeFileImpl((PsiManagerImpl)getManager(), this); } return new PsiPlainTextFileImpl(this); }
@Nullable protected PsiFile createFile(@Nonnull Project project, @Nonnull VirtualFile file, @Nonnull FileType fileType) { if (fileType.isBinary() || file.is(VFileProperty.SPECIAL)) { return SingleRootFileViewProvider.isTooLargeForContentLoading(file) ? new PsiLargeBinaryFileImpl((PsiManagerImpl)getManager(), this) : new PsiBinaryFileImpl((PsiManagerImpl)getManager(), this); } if (!SingleRootFileViewProvider.isTooLargeForIntelligence(file)) { final PsiFile psiFile = createFile(getBaseLanguage()); if (psiFile != null) return psiFile; } if (SingleRootFileViewProvider.isTooLargeForContentLoading(file)) { return new PsiLargeTextFileImpl(this); } return new PsiPlainTextFileImpl(this); }
@Override protected PsiFile createFile(@NotNull Project project, @NotNull VirtualFile file, @NotNull FileType fileType) { FileIndexFacade fileIndex = ServiceManager.getService(project, FileIndexFacade.class); if(!fileIndex.isInLibraryClasses(file) && fileIndex.isInSource(file) || fileIndex.isExcludedFile(file)) { return new PsiBinaryFileImpl((PsiManagerImpl) getManager(), this); } // skip inner, anonymous, missing and corrupted classes try { if(!isInnerClass(file)) { return new ClsFileImpl(this); } } catch(Exception e) { Logger.getInstance(ClassFileViewProvider.class).debug(file.getPath(), e); } return null; }