public static void showDiffForChange( final Iterable<Change> changes, final Condition<Change> selectionChecker, final Project project, @NotNull ShowDiffUIContext context) { int newIndex = -1; ChangeForDiffConvertor convertor = new ChangeForDiffConvertor(project, true); final List<DiffRequestPresentable> changeList = ContainerUtil.newArrayList(); for (Change change : changes) { if (!directoryOrBinary(change)) { // todo DiffRequestPresentable presentable = convertor.convert(change); if (presentable != null) { if ((newIndex == -1) && selectionChecker.value(change)) { newIndex = changeList.size(); } changeList.add(presentable); } } } if (changeList.isEmpty()) { return; } if (newIndex < 0) { newIndex = 0; } showDiffImpl(project, changeList, newIndex, context); }
@Nullable private static Change[] loadFakeRevisions(final Project project, final Change[] changes) { List<Change> matchingChanges = new ArrayList<Change>(); for (Change change : changes) { matchingChanges.addAll( ChangeListManager.getInstance(project).getChangesIn(ChangesUtil.getFilePath(change))); } return matchingChanges.toArray(new Change[matchingChanges.size()]); }