public static void showDiffForChange( final Change[] changes, int index, final Project project, @NotNull ShowDiffUIContext context) { final Change selected = index >= 0 ? changes[index] : null; /*if (isBinaryDiff(project, changes, index)) { showBinaryDiff(project, changes[index]); return; }*/ showDiffForChange( Arrays.asList(changes), new Condition<Change>() { @Override public boolean value(final Change change) { return selected != null && selected.equals(change); } }, project, context); }
private static boolean checkNotifyBinaryDiff(final Change selectedChange) { final ContentRevision beforeRevision = selectedChange.getBeforeRevision(); final ContentRevision afterRevision = selectedChange.getAfterRevision(); if (beforeRevision instanceof BinaryContentRevision && afterRevision instanceof BinaryContentRevision) { try { byte[] beforeContent = ((BinaryContentRevision) beforeRevision).getBinaryContent(); byte[] afterContent = ((BinaryContentRevision) afterRevision).getBinaryContent(); if (Arrays.equals(beforeContent, afterContent)) { Messages.showInfoMessage( VcsBundle.message("message.text.binary.versions.are.identical"), VcsBundle.message("message.title.diff")); } else { Messages.showInfoMessage( VcsBundle.message("message.text.binary.versions.are.different"), VcsBundle.message("message.title.diff")); } } catch (VcsException e) { Messages.showInfoMessage(e.getMessage(), VcsBundle.message("message.title.diff")); } return true; } return false; }