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); }
public static void showDiffForChange( final Iterable<Change> changes, final Condition<Change> selectionChecker, final Project project, @NotNull ShowDiffUIContext context) { int cnt = 0; int newIndex = -1; final List<Change> changeList = new ArrayList<Change>(); for (Change change : changes) { if (!directoryOrBinary(change)) { // todo changeList.add(change); if ((newIndex == -1) && selectionChecker.value(change)) { newIndex = cnt; } ++cnt; } } if (changeList.isEmpty()) { return; } if (newIndex < 0) { newIndex = 0; } showDiffImpl( project, ObjectsConvertor.convert( changeList, new ChangeForDiffConvertor(project, true), ObjectsConvertor.NOT_NULL), 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()]); }