|isModified() returns true on undo though reverting to saved state [message #941207]
||Fri, 12 October 2012 05:46
| Anit Nair
Registered: October 2012
My application contains a Multipage graphical editor. I using emf 0.8 with graphiti 0.9.0.|
Editor uses the resource.isModified() call to check for dirty state. I have set
setTrackingModification() true option for the resource as well. The call works as expected for any resource change. However, it behaves strangely for undo commands.
Following the use case:
1) I open an existing resource in the editor. resource is in saved state. Editor is in saved state. (OK)
2) I make some changes to the resource. The resource.ismodified() return false. Editor is in dirty state. (OK)
3) I undo the change made. The resource.ismodified() still returns true. Editor is in dirty state yet. (Not Ok).
I am not sure why the resource.isModified() would return true on undo().
|Re: isModified() returns true on undo though reverting to saved state [message #943586 is a reply to message #943422]
||Sun, 14 October 2012 12:52
| Ed Merks
Registered: July 2009
On 14/10/2012 3:33 PM, Anit Nair wrote:
> Thanks for the comments. I modified the implementation as per the
> generated editor and it seems to work ok. However, there is still some
> behavior which seems little different from what i expected.
> Here is the use case.
> - Open the editor (Save point 1)
> - Make some changes (gets dirty)
> - Undo the changes (goes back to save point 1)
I'd expect it to be clean.
> - Redo the changes and save (save point 2)
I'd expect it to be dirty again and then be clean when you save.
> - Again make some changes ( gets dirty)
Yes, I'd expect it to get dirty.
> - Undo the changes (goes to save point 2)
It should be clean again.
> - Undo again (makes editor dirty as save point 2 is undone)
Yes, it should be dirty again.
> - Undo again, i would expect it to go to save point 1, but it still
> remains dirty.
You saved for save point 2, that's the only command stack state where
it's clean. This reflects the command stack being in the same known
state as the file system. Any other state of the command stack is
dirty. There's only one save point.
> Is this expected behavior, if yes why so.
The command stack is dirty any time the model's state doesn't match the
Powered by FUDForum
. Page generated in 0.05303 seconds