[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmf] Re: Undo / Redo for whole Commandstack

I think the easiest way for me would be, just to implement my own undo /
redo actions and let them do sth. like this:

    if (editingDomain.getCommandStack().canUndo()) {
            editingDomain.getCommandStack().undo();
    }

Well, but i do not know how to replace the undo / redo actions with my
own actions. Does anybody know how to do that?

Arne


Tom Schindl schrieb:
> How are you executing the command? To make the command part of the
> undo/redo stack you need to execute them like this:
> 
> ----------8<----------
> Command cmd = AddCommand.create(service.getEditingDomain(), parent,
> EXTLibraryPackage.Literals.LIBRARY__WRITERS, w);
> 
> if( cmd.canExecute() ) {
>     editingDomain.getCommandStack().execute(cmd);
> }
> ----------8<----------	
> 
> 
> Tom
> 
> Arne schrieb:
>> Hi all,
>>
>> i am trying to analyse how undo / redo works in GMF. Unfortunately i
>> wasn't very succesful. I just want to let undo / redo work on the whole
>> command stack of the editing domain, instead of just providing
>> funcionality for commands that are run on the graphical editor.
>>
>> The situation is, that i got a multi tab editor with a tree viewer for
>> the model and a tab with a GMF created editor. When doing something in
>> the GMF-Tab on the model like creating a new elemnt, it can also be
>> undone in the viewer. However, changes that are made in the tree viewer
>> on the model can not be undone in the diagram editor tab. Well, is there
>> a way to let die diagram editor simply provide undo / redo for the whole
>> command stack?
>> Both tabs ware working with the same editing domain, of course.
>>
>> I also made my own cut / copy / paste commands, that are wrapping the
>> EMF clipboard commands (to let the domain elements get copied instead of
>> just copying the visual parts). When these commands are executed, they
>> also can not be undone.
>>
>> Thx in advance, Arne :)
> 
>