protected AbstractFileViewProvider(@Nonnull PsiManager manager, @Nonnull VirtualFile virtualFile, boolean eventSystemEnabled, @Nonnull FileType type) { myManager = (PsiManagerEx)manager; myVirtualFile = virtualFile; myEventSystemEnabled = eventSystemEnabled; setContent(new VirtualFileContent()); myPhysical = isEventSystemEnabled() && !(virtualFile instanceof LightVirtualFile) && !(virtualFile.getFileSystem() instanceof NonPhysicalFileSystem); virtualFile.putUserData(FREE_THREADED, isFreeThreaded(this)); myFileType = type; if (virtualFile instanceof VirtualFileWindow && !(this instanceof FreeThreadedFileViewProvider)) { throw new IllegalArgumentException("Must not create "+getClass()+" for injected file "+virtualFile+"; InjectedFileViewProvider must be used instead"); } }
@Override public boolean isInProject(@Nonnull PsiElement element) { if (element instanceof PsiDirectoryContainer) { PsiDirectory[] dirs = ((PsiDirectoryContainer)element).getDirectories(); for (PsiDirectory dir : dirs) { if (!isInProject(dir)) return false; } return true; } PsiFile file = element.getContainingFile(); VirtualFile virtualFile = null; if (file != null) { virtualFile = file.getViewProvider().getVirtualFile(); } else if (element instanceof PsiFileSystemItem) { virtualFile = ((PsiFileSystemItem)element).getVirtualFile(); } if (file != null && file.isPhysical() && virtualFile.getFileSystem() instanceof NonPhysicalFileSystem) return true; return virtualFile != null && myFileIndex.isInContent(virtualFile); }
protected SingleRootFileViewProvider(@NotNull PsiManager manager, @NotNull VirtualFile virtualFile, final boolean eventSystemEnabled, @NotNull Language language, @NotNull FileType type) { myManager = manager; myVirtualFile = virtualFile; myEventSystemEnabled = eventSystemEnabled; myBaseLanguage = language; setContent(new VirtualFileContent()); myPhysical = isEventSystemEnabled() && !(virtualFile instanceof LightVirtualFile) && !(virtualFile.getFileSystem() instanceof NonPhysicalFileSystem); myFileType = type; }
@Override public boolean contains(final VirtualFile file, @NotNull final Project project, @Nullable final NamedScopesHolder holder) { // do not include fake-files e.g. fragment-editors, database consoles, etc. if (file == null || file.getFileSystem() instanceof NonPhysicalFileSystem) { return false; } if (!file.isInLocalFileSystem()) { return true; } if (isInsideProjectContent(project, file)) { return false; } return !ProjectScope.getProjectScope(project).contains(file); }
protected SingleRootFileViewProvider(@NotNull PsiManager manager, @NotNull VirtualFile virtualFile, final boolean physical, @NotNull Language language) { myManager = manager; myVirtualFile = virtualFile; myEventSystemEnabled = physical; myBaseLanguage = language; setContent(new VirtualFileContent()); myPhysical = isEventSystemEnabled() && !(virtualFile instanceof LightVirtualFile) && !(virtualFile.getFileSystem() instanceof NonPhysicalFileSystem); myExclusionManager = ProjectFileExclusionManager.SERVICE.getInstance(manager.getProject()); }
@Override public FileStatus getStatus(@Nonnull final VirtualFile file) { if (file.getFileSystem() instanceof NonPhysicalFileSystem) { return FileStatus.SUPPRESSED; // do not leak light files via cache } FileStatus status = getCachedStatus(file); if (status == null || status == FileStatusNull.INSTANCE) { status = calcStatus(file); cacheChangedFileStatus(file, status); } return status; }
@Override public boolean isPhysical() { final VirtualFile file = getVirtualFile(); return file != null && !(file.getFileSystem() instanceof NonPhysicalFileSystem); }
@Override public boolean isPhysical() { return !(myFile.getFileSystem() instanceof NonPhysicalFileSystem) && !(myFile.getFileSystem().getProtocol().equals("temp")); }