VirtualFile (@Nullable Project project, @NotNull VirtualFile file) { FileChooserDescriptor descriptor; String key; Type type = getType(file); if (type == Type.DIRECTORY || type == Type.ARCHIVE) { descriptor = new FileChooserDescriptor(false, true, true, true, true, false); key = LAST_USED_FOLDER_KEY; } else { descriptor = new FileChooserDescriptor(true, false, false, true, true, false); key = LAST_USED_FILE_KEY; } VirtualFile selectedFile = getDefaultSelection(project, key, file); VirtualFile otherFile = FileChooser.chooseFile(descriptor.withTitle(DiffBundle.message("select.file.to.compare")), project, selectedFile); if (otherFile != null) updateDefaultSelection(project, key, otherFile); return otherFile; }