[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmf] IUndoContext and Undo/Redo actions

Hello guys.

As far as I know, GMF commands implement the interface IUndoableOperation, which includes the concept of IUndoContext. This concept is also important in Undo/Redo action handlers, since we need to tell those handlers which context to cover, it is, they will get from the OperationHistory just those commands with the same UndoContext. At least this is what I understand from what I read. Exactly as it says, if I create a GMF command and I execute it this way: DiagramEditor().getDiagramCommandStack().execute(command), that DiagramCommandStack has a method to get the IUndoContext it is working with.

But then I find a problem with working with the TransactionalEditingDomain.commandStack(). If I have an EMF command, and I execute it this way: editingDomain().getCommandStack().execute(command) I don't really know which context it is operating under, since that CommandStack has no UndoContext and EMF command have no UndoContext either. But when you are working in the DigramaEditor and you execute a command this way, you do get the possibility of Undoing that command from the edit menú. How is this possible? Which undo context have those commands executed in the TransactionalEditingDomain? I need to understand this because I'm trying to make some modifications in the model when the diagram is closed and I just have this EditingDomain CommandStack (not the DiagramCommandStack), and I don't get to see my executed commands in the edit menú.

Does anyone have an idea about this? I would really appreciate any help..

Thank you!