@NotNull @Override public CellAppearanceEx forVirtualFile(@NotNull final VirtualFile file) { if (!file.isValid()) { return forInvalidUrl(file.getPresentableUrl()); } final VirtualFileSystem fileSystem = file.getFileSystem(); if (fileSystem.getProtocol().equals(JarFileSystem.PROTOCOL)) { return new JarSubfileCellAppearance(file); } if (fileSystem instanceof HttpFileSystem) { return new HttpUrlCellAppearance(file); } if (file.isDirectory()) { return SimpleTextCellAppearance.regular(file.getPresentableUrl(), PlatformIcons.FOLDER_ICON); } return new ValidFileCellAppearance(file); }
@NotNull @Override public CellAppearanceEx forIoFile(@NotNull final File file) { final String absolutePath = file.getAbsolutePath(); if (!file.exists()) { return forInvalidUrl(absolutePath); } if (file.isDirectory()) { return SimpleTextCellAppearance.regular(absolutePath, PlatformIcons.FOLDER_ICON); } final String name = file.getName(); final FileType fileType = FileTypeManager.getInstance().getFileTypeByFileName(name); final File parent = file.getParentFile(); final CompositeAppearance appearance = CompositeAppearance.textComment(name, parent.getAbsolutePath()); appearance.setIcon(fileType.getIcon()); return appearance; }