Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Disabling Undo of Graphical Changes?(Is there any way to disable undo?)
Disabling Undo of Graphical Changes? [message #1066655] Wed, 03 July 2013 15:10 Go to next message
Philip Alldredge is currently offline Philip AlldredgeFriend
Messages: 20
Registered: February 2013
Junior Member
I am working with a non-EMF model. I have implemented canUndo() on my features to return false. However, undo is not disabled and the user is able to call undo which rolls back any changes to the Graphical EMF model. I have noticed that unless ICustomUndoableFeature is implemented that canUndo is not even called and that GFWorkspaceCommandStackImpl first rolls back EMF undo's before checking whether features can be undone.

Is there any way to completely disable undo after a feature that can not be undone is executed? I would like to implement undo capability in the future for my features but in the meanwhile I would like to be able to prevent partial undo which result from the graphical model being undone but not the domain model.

Thank you
Re: Disabling Undo of Graphical Changes? [message #1066684 is a reply to message #1066655] Wed, 03 July 2013 17:49 Go to previous messageGo to next message
Philip Alldredge is currently offline Philip AlldredgeFriend
Messages: 20
Registered: February 2013
Junior Member
I was able to work around the issue by overriding executeFeature in my Diagram Editor. I would be interested it there is a recommended way to do it that I have overlooked. The code is below.
@Override
public Object executeFeature(IFeature feature, IContext context) {
	// Execute the feature and flush the command stack if the feature was no undoable.
	// This will prevent the user being able to perform partial undo's when the features does not support it
	final boolean canUndo = feature.canUndo(context);
	final Object ret = super.executeFeature(feature, context);
	final TransactionalEditingDomain editingDomain = this.getEditingDomain();
	if(!canUndo) {
		editingDomain.getCommandStack().flush();	
	}
	
	return ret;
}
Re: Disabling Undo of Graphical Changes? [message #1066813 is a reply to message #1066655] Thu, 04 July 2013 13:34 Go to previous message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Philip,

this sounds like a bug. The check seems to get stuck in the wrapping
EMFOperation. Would you please file that as a bugzilla?

Thanks,
Michael
Previous Topic:is it possible to hatch a rectangle?
Next Topic:Retrieving mouse position
Goto Forum:
  


Current Time: Thu Apr 25 04:33:07 GMT 2024

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

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

Back to the top