Skip to main content



      Home
Home » Modeling » Graphiti » How to reset dirty state in a graphiti diagram?
How to reset dirty state in a graphiti diagram? [message #1698703] Wed, 17 June 2015 07:14 Go to next message
Eclipse UserFriend
Hello

After opening an Eclipse Graphiti editor I want to do some initialization changes on the diagram. Doing that, using transactions, the editor turns dirty.
I didn't find a way to reset the dirty state, I don't want to save the diagram at this point.
BasicCommandStack commandStack = (BasicCommandStack) getEditingDomain().getCommandStack();
commandStack.execute(new RecordingCommand(getEditingDomain()) {
    @Override
    protected void doExecute() {
        // do some change
    }
});

If I use flush() on the command stack, my init changes are undone as well:
BasicCommandStack commandStack = (BasicCommandStack) getEditingDomain().getCommandStack();
commandStack.flush();

Is there a way to reset the dirty state?
Maybe there is a way to disable transaction handling or command stack recording?

greets
Flavio
Re: How to reset dirty state in a graphiti diagram? [message #1698875 is a reply to message #1698703] Thu, 18 June 2015 09:25 Go to previous messageGo to next message
Eclipse UserFriend
Flavio,

if you use a Graphiti feature to execute your changes, you can override
hasDoneChanges() and return false. That will trigger the Graphiti framework
not to put that feature (actually the EMF command around it) onto the
command stachk and your editor will be in saved state.

Michael
Re: How to reset dirty state in a graphiti diagram? [message #1702598 is a reply to message #1698875] Thu, 23 July 2015 09:18 Go to previous messageGo to next message
Eclipse UserFriend
Hi,
I have just tried to overwrite hasDoneChanges() to avoid that the editor is marked dirty after one of my features is executed. This causes some problems in the undo/redo-behavior.
When debugging the code I found out, that "getMostRecentCommand()" and "getUndoCommand()" return the command which was not added to the list of commands...
I have opened a bugzilla: https://bugs.eclipse.org/bugs/show_bug.cgi?id=473395

Best regards,
Julia
Re: How to reset dirty state in a graphiti diagram? [message #1702599 is a reply to message #1698875] Thu, 23 July 2015 09:20 Go to previous message
Eclipse UserFriend
Hi,
I have just tried to overwrite hasDoneChanges() to avoid that the editor is marked dirty after one of my features is executed. This causes some problems in the undo/redo-behavior.
When debugging the code I found out, that "getMostRecentCommand()" and "getUndoCommand()" return the command which was not added to the list of commands...
I have opened a bugzilla: https://bugs.eclipse.org/bugs/show_bug.cgi?id=473395

Best regards,
Julia
Previous Topic:Graphiti ToolTips
Next Topic:EXECUTABLE DIAGRAMS
Goto Forum:
  


Current Time: Wed Jun 18 06:04:38 EDT 2025

Powered by FUDForum. Page generated in 0.27792 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top