Community
Participate
Working Groups
Build ID: I20070625-1500 Steps To Reproduce: 1.Using a transactionnal EMF editor, do several modifications on a document. 2.Save it 3.Undo ALL your modifications. The dirty flag become false at the end of the stack. More information: The following method of the WorkspaceCommandStackImpl class : public boolean isSaveNeeded() { IUndoableOperation nextUndoableOperation = history.getUndoOperation(getDefaultUndoContext()); if (nextUndoableOperation == null) return false; return savedContext != null ? !nextUndoableOperation.hasContext(getSavedContext()) : true; } perhaps should be something like this public boolean isSaveNeeded() { IUndoableOperation nextUndoableOperation = history.getUndoOperation(getDefaultUndoContext()); if ( (nextUndoableOperation == null) && (savedContext != null) ) return false; return savedContext != null ? !nextUndoableOperation.hasContext(getSavedContext()) : true; } but we need to test
That makes a good deal of sense to me. The bottom of the command-stack shouldn't be considered as an implicit savepoint unless the editor had never been saved since opening. That leads me think that the test should actually be: if ( (nextUndoableOperation == null) && (savedContext == null) ) return false;
Christian, I made obviously a little mistake on my conditional test, yours seems to be quite better !
Committed the fix to CVS HEAD (1.2 release), with a JUnit test implementing the original problem scenario. The fix actually ended up slightly different to account for the null 'nextUndoableOperation': if (nextUndoableOperation == null) { return savedContext != null; }
Fix in CVS.
Fix available in HEAD: 1.2.0.I200802062040.