/** * Flush the modified content back to input elements via the content provider. The provided input * may be the current input of the viewer or it may be the previous input (i.e. this method may be * called to flush modified content during an input change). * * @param input the compare input * @param monitor a progress monitor or <code>null</code> if the method was call from a place * where a progress monitor was not available. * @since 3.3 */ protected void flushContentOld(Object input, IProgressMonitor monitor) { // write back modified contents IMergeViewerContentProvider content = (IMergeViewerContentProvider) getContentProvider(); if (content == null) { return; } boolean leftEmpty = content.getLeftContent(input) == null; boolean rightEmpty = content.getRightContent(input) == null; if (getCompareConfiguration().isLeftEditable() && isLeftDirty()) { byte[] bytes = getContents(true); if (rightEmpty && bytes != null && bytes.length == 0) bytes = null; setLeftDirty(false); content.saveLeftContent(input, bytes); } if (getCompareConfiguration().isRightEditable() && isRightDirty()) { byte[] bytes = getContents(false); if (leftEmpty && bytes != null && bytes.length == 0) bytes = null; setRightDirty(false); content.saveRightContent(input, bytes); } }
private void internalRefresh(Object input) { IMergeViewerContentProvider content = getMergeContentProvider(); if (content == null) { return; } Object ancestor = content.getAncestorContent(input); boolean oldFlag = fIsThreeWay; if (Utilities.isHunk(input)) { fIsThreeWay = true; } else if (input instanceof ICompareInput) fIsThreeWay = (((ICompareInput) input).getKind() & Differencer.DIRECTION_MASK) != 0; else fIsThreeWay = ancestor != null; if (fAncestorItem != null) fAncestorItem.setVisible(fIsThreeWay); if (fAncestorVisible && oldFlag != fIsThreeWay) fComposite.layout(true); Object left = content.getLeftContent(input); Object right = content.getRightContent(input); updateContent(ancestor, left, right); // https://bugs.eclipse.org/bugs/show_bug.cgi?id=453799 // Content provider may be disposed after call to updateContent() content = getMergeContentProvider(); if (content == null) { return; } updateHeader(); ToolBarManager tbm = CompareViewerPane.getToolBarManager(fComposite.getParent()); if (tbm != null) { updateToolItems(); tbm.update(true); tbm.getControl().getParent().layout(true); } }