private void setSplitterProportion(DiffContent content1, DiffContent content2) { if (content1.isEmpty()) { mySplitter.setProportion(0f); mySplitter.setResizeEnabled(false); return; } if (content2.isEmpty()) { mySplitter.setProportion(1.0f); mySplitter.setResizeEnabled(false); return; } mySplitter.setProportion(0.5f); mySplitter.setResizeEnabled(true); }
public void setContents(DiffContent content1, DiffContent content2) { LOG.assertTrue(content1 != null && content2 != null); LOG.assertTrue(!myDisposed); myData.setContents(content1, content2); Project project = myData.getProject(); FileType[] types = DiffUtil.chooseContentTypes(new DiffContent[] {content1, content2}); VirtualFile beforeFile = content1.getFile(); VirtualFile afterFile = content2.getFile(); String path = myDiffRequest == null ? null : myDiffRequest.getWindowTitle(); myLeftSide.setHighlighterFactory( createHighlighter(types[0], beforeFile, afterFile, path, project)); myRightSide.setHighlighterFactory( createHighlighter(types[1], afterFile, beforeFile, path, project)); setSplitterProportion(content1, content2); rediff(); if (myIsRequestFocus) { myPanel.requestScrollEditors(); } }