Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 11:14 Go to next message
Flavio Donze is currently offline Flavio DonzeFriend
Messages: 211
Registered: July 2009
Location: Switzerland
Senior Member
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


Prozessmanagement und Qualitätsmanagement Software QMS/IMS
https://www.scodi.ch
Re: How to reset dirty state in a graphiti diagram? [message #1698875 is a reply to message #1698703] Thu, 18 June 2015 13:25 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1932
Registered: July 2009
Location: Walldorf, Germany
Senior Member
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 13:18 Go to previous messageGo to next message
Julia Heinrich is currently offline Julia HeinrichFriend
Messages: 2
Registered: July 2015
Junior Member
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 13:20 Go to previous message
Julia Heinrich is currently offline Julia HeinrichFriend
Messages: 2
Registered: July 2015
Junior Member
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: Fri Nov 08 23:38:50 GMT 2024

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

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

Back to the top