Command Stack change and save action [message #754168] |
Tue, 01 November 2011 07:29 |
karthick9686@gmail.com Missing name Messages: 41 Registered: July 2011 |
Member |
|
|
hello friends,
i have an gef based editor the changes in the model causes the isdirty state of the editor to become true and enables the save action .
i have an figure in an editpart for which i have added mouse listener , the mouse presssed event of the listener will causes the figure to resize . the resize is done using an class the executes the command class and i execute it from the editpart by calling the getcommandstack method of the editor instance .
inSpireDesignerEditor.getDomain().getCommandStack().execute( cmd );
i have two problems now .
1. the undo of the command that executed is not working
2. as the figure resizes using the mouse event , the editor save button is not getting enabled , but the is dirty property is true. how to manually eneble the save action from an editpart
[Updated on: Tue, 01 November 2011 07:29] Report message to a moderator
|
|
|
Re: Command Stack change and save action [message #754171 is a reply to message #754168] |
Tue, 01 November 2011 07:48 |
|
The execution of the command on the stack looks good so far. Concerning your problems,
1) you should check that your command is undoable (canUndo() has to return true) and that you implement undo() properly
2) if you have finished 1) and it still does not work, you should ensure that the save action gets updated when changes to the command stack occur. GraphicalEditor maintains a list of actions (stackActions) for this purpose, which is updated in case the command stack changes. If you are inheriting from GraphicalEditor, make sure UndoAction is contained within this list (which it should in case you have not overwritten createActions() or you have overwritten it with a call to the super implementation). If you are not inheriting from GraphicalEditor, you will have to update the action from within a command stack listener yourself.
|
|
|
|
Re: Command Stack change and save action [message #755563 is a reply to message #754174] |
Tue, 08 November 2011 19:50 |
|
Take a look into GraphicalEditor#init(IEditorSite, IEditorInput), where the editor gets registered as command stack listener, and within the GraphicalEditor#commandStackChanged(EventObject) method, which in turn gets called upon changes. It calls updateActions(List) to update all actions that depend on changes being made to the command stack.
|
|
|
Powered by
FUDForum. Page generated in 0.03268 seconds