Skip to main content



      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 11:10 Go to next message
Eclipse UserFriend
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 13:49 Go to previous messageGo to next message
Eclipse UserFriend
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 09:34 Go to previous message
Eclipse UserFriend
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: Sun Jul 13 14:30:14 EDT 2025

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

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

Back to the top