DiffElement (@NotNull DiffContent content) { if (content instanceof EmptyContent) { return new DiffElement() { @Override public String getPath() { return ""; } @NotNull @Override public String getName() { return "Nothing"; } @Override public long getSize() { return -1; } @Override public long getTimeStamp() { return -1; } @Override public boolean isContainer() { return true; } @Override public DiffElement[] getChildren() { return EMPTY_ARRAY; } @Override public byte[] getContent() { return null; } @Override public Object getValue() { return null; } }; } if (content instanceof DirectoryContent) { return VirtualFileDiffElement.createElement(((DirectoryContent)content).getFile()); } if (content instanceof FileContent && content.getContentType() instanceof ArchiveFileType) { return VirtualFileDiffElement.createElement(((FileContent)content).getFile()); } throw new IllegalArgumentException(content.getClass() + " " + content.getContentType()); }