@Override public boolean isDirty() { if (fFocusPart == fLeft) { return isLeftDirty(); } else if (fFocusPart == fRight) { return isRightDirty(); } return false; }
private void updateDirtyState(IEditorInput key, IDocumentProvider documentProvider, char type) { boolean dirty = documentProvider.canSaveDocument(key); boolean oldLeftDirty = isLeftDirty(); boolean oldRightDirty = isRightDirty(); if (type == LEFT_CONTRIBUTOR) setLeftDirty(dirty); else if (type == RIGHT_CONTRIBUTOR) setRightDirty(dirty); if ((oldLeftDirty && !isLeftDirty()) || (oldRightDirty && !isRightDirty())) { /* * Dirty state has changed from true to false, combined dirty state * is false. _In most cases_ this means that save has taken place * outside compare editor. Ask to redo diff calculation when the * editor gets focus. * * However, undoing all the changes made in another editor would * result in asking for redo diff as well. In this case, we set the * flag back to false, see * TextMergeViewer.documentChanged(DocumentEvent, boolean) */ fRedoDiff = true; } }
@Override void flushLeftSide(Object oldInput, IProgressMonitor monitor){ IMergeViewerContentProvider content= getMergeContentProvider(); Object leftContent = content.getLeftContent(oldInput); if (leftContent != null && isLeftEditable() && isLeftDirty()) { if (fLeftContributor.hasSharedDocument(leftContent)) { if (flush(fLeftContributor)) setLeftDirty(false); } } if (!(content instanceof MergeViewerContentProvider) || isLeftDirty()) { super.flushLeftSide(oldInput, monitor); } }
@Override protected void flushContent(Object oldInput, IProgressMonitor monitor) { flushLeftSide(oldInput, monitor); flushRightSide(oldInput, monitor); IMergeViewerContentProvider content = getMergeContentProvider(); if (!(content instanceof MergeViewerContentProvider) || isLeftDirty() || isRightDirty()) { super.flushContent(oldInput, monitor); } }
protected void flushContent(Object oldInput, IProgressMonitor monitor) { // check and handle any shared buffers IMergeViewerContentProvider content= getMergeContentProvider(); Object leftContent = content.getLeftContent(oldInput); Object rightContent = content.getRightContent(oldInput); if (leftContent != null && getCompareConfiguration().isLeftEditable() && isLeftDirty()) { if (fLeftContributor.hasSharedDocument(leftContent)) { if (flush(fLeftContributor)) setLeftDirty(false); } } if (rightContent != null && getCompareConfiguration().isRightEditable() && isRightDirty()) { if (fRightContributor.hasSharedDocument(rightContent)) { if (flush(fRightContributor)) setRightDirty(false); } } if (!(content instanceof MergeViewerContentProvider) || isLeftDirty() || isRightDirty()) { super.flushContent(oldInput, monitor); } }
setRightDirty(dirty); if (!isLeftDirty() && !isRightDirty()) { fRedoDiff = false; final Diff oldDiff = getLastDiff();