public static void showDiffImpl( final Project project, @NotNull List<DiffRequestPresentable> changeList, int index, @NotNull final ShowDiffUIContext context) { final ChangeDiffRequest request = new ChangeDiffRequest( project, changeList, context.getActionsFactory(), context.isShowFrame()); final DiffTool tool = DiffManager.getInstance().getDiffTool(); final DiffRequest simpleRequest; try { request.quickCheckHaveStuff(); simpleRequest = request.init(index); } catch (VcsException e) { Messages.showWarningDialog(e.getMessage(), "Show Diff"); return; } if (simpleRequest != null) { final DiffNavigationContext navigationContext = context.getDiffNavigationContext(); if (navigationContext != null) { simpleRequest.passForDataContext(DiffTool.SCROLL_TO_LINE, navigationContext); } tool.show(simpleRequest); } }
private static void showBinaryDiff(Project project, Change change) { try { final SimpleDiffRequest request = createBinaryDiffRequest(project, change); if (DiffManager.getInstance().getDiffTool().canShow(request)) { DiffManager.getInstance().getDiffTool().show(request); } } catch (VcsException e) { Messages.showWarningDialog(e.getMessage(), "Show Diff"); } }
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; }