List of usage examples for com.intellij.openapi.diff DiffRequest getContents
public abstract DiffContent @NotNull [] getContents();
From source file:com.urswolfer.intellij.plugin.gerrit.ui.diff.CustomizableFrameDiffTool.java
License:Apache License
private static boolean askForceOpenDiff(DiffRequest data) { byte[] bytes1; byte[] bytes2; try {/*from w w w .jav a2s . co m*/ bytes1 = data.getContents()[0].getBytes(); bytes2 = data.getContents()[1].getBytes(); } catch (IOException e) { MessagesEx.error(data.getProject(), e.getMessage()).showNow(); return false; } String message = Arrays.equals(bytes1, bytes2) ? DiffBundle.message("diff.contents.are.identical.message.text") : DiffBundle.message("diff.contents.have.differences.only.in.line.separators.message.text"); Messages.showInfoMessage(data.getProject(), message, DiffBundle.message("no.differences.dialog.title")); return false; }
From source file:com.urswolfer.intellij.plugin.gerrit.ui.diff.CustomizableFrameDiffTool.java
License:Apache License
public static boolean canShowDiff(DiffRequest data) { DiffContent[] contents = data.getContents(); if (contents.length != 2) return false; for (DiffContent content : contents) { if (content.isBinary()) return false; VirtualFile file = content.getFile(); if (file != null && file.isDirectory()) return false; }//from ww w . ja v a 2 s . c o m return true; }
From source file:com.urswolfer.intellij.plugin.gerrit.ui.diff.CustomizableFrameDiffTool.java
License:Apache License
protected DiffPanel createDiffPanel(DiffRequest data, Window window, @NotNull Disposable parentDisposable, FrameDiffTool tool) {/*from w w w . j a v a 2 s.c o m*/ DiffPanel diffPanel = null; try { diffPanel = new DiffPanelImpl(window, data.getProject(), true, true, DiffManagerImpl.FULL_DIFF_DIVIDER_POLYGONS_OFFSET, tool) { @Override public void setDiffRequest(DiffRequest data) { super.setDiffRequest(data); diffRequestChange(data, this); } }; int contentCount = data.getContents().length; LOG.assertTrue(contentCount == 2, String.valueOf(contentCount)); LOG.assertTrue(data.getContentTitles().length == contentCount); diffPanel.setDiffRequest(data); return diffPanel; } catch (RuntimeException e) { if (diffPanel != null) { Disposer.dispose(diffPanel); } throw e; } }