Undo/Redo Actions Disabled [message #1214026] |
Wed, 27 November 2013 09:01  |
Eclipse User |
|
|
|
Hi,
I am new to EMF and in general to developing RCP application. I've been developing my first EMF based RCP application where I develop a multipage editor. I reused some of the methods from the default editor, and in addition to this I developed custom editor parts with multiple JFace Viewers per page which are used for viewing and editing the EMF objects. My problem now is that the undo and redo actions in the global actions menu are disabled. I checked with debugging that my CommandStack is maintained properly and I am only using EMF Commands. Another thing I notice is that if an actions is executed in the editor I developed, the undo/redo actions remain disabled. If I afterwards change some of the attributes of the objects using the Properties View, the undo/redo actions get enabled and the commands executed within my editor can be undone as well. Could you maybe give me some direction of what could my problem be and how can I solve it?
Thanks,
Evica
|
|
|
|
|
|
Re: Undo/Redo Actions Disabled [message #1216645 is a reply to message #1216298] |
Thu, 28 November 2013 10:19   |
Eclipse User |
|
|
|
Hi Cedric,
No undo/redo is not working when I trigger it with the keyboard. I do not have an ApplicationActionBarAdvisor. As I am working on only customizing the default editor generated for an EMF model (a did not create the EMF model nor I can change it in any way) this is what I did:
I generated the default editor for the model that was already created.
I copied the the editor class and ActionBarContributor from the generated default editor in my own eclipse plugin project.
I removed from the default editor class the default viewer panes and viewers.
I created new custom classes that extend EditorPart, each of them being one page in my MultiPageEditor.
In each of these EditorParts I have few Jface Viewers (Tree or Table). In order to show my model objects in the Viewers, or customize the default behavior of the viewers, I mostly follow the book EMF Eclipse Modeling 2nd Edition. To change the default behavior of the modeled classes I extend the default ItemProviders and add custom behavior there. To edit the objects I use cell editors. I only use EMF commands to change my model. For example:
editor.getEditingDomain().getCommandStack().execute(SetCommand.create(editor.getEditingDomain(),item.getData(), feature, value));
This is the first eclipse plugin that I am developing, and the first time I am working with EMF, so my knowledge is quite basic.
Thanks,
Evica
[Updated on: Thu, 28 November 2013 10:20] by Moderator
|
|
|
Re: Undo/Redo Actions Disabled [message #1216878 is a reply to message #1216645] |
Thu, 28 November 2013 12:22   |
Eclipse User |
|
|
|
Evica,
Sorry, but these things work in the generated editor, so if they don't
work for you, you've done something that's not helping, and I can't
guess what it might be. All I can suggest is you look at that things
I've suggested you look at, i.e., when are the global action handlers
informed that they need to handle actions for the view that you've given
focus?
On 28/11/2013 4:19 PM, Evica Ilieva wrote:
> Hi Cedric,
>
> No undo/redo is not working when I trigger it with the keyboard. I do
> not have an ApplicationActionBarAdvisor. As I am working on only
> customizing the default editor generated for an EMF model (a did not
> create the EMF model nor I can change it in any way) this is what I did:
>
> I generated the default editor for the model that was already created.
> I copied the the editor class and ActionBarContributor from the
> generated default editor in my own eclipse plugin project.
> I removed from the default editor class the default viewer panes and
> viewers. I created new custom classes that extend EditorPart, each of
> the being one page in my MultiPageEditor.
> In each of these EditorParts I have few Jface Viewers (Tree or Table).
> In order to show my model objects in the Viewers, or customize the
> default behavior of the viewers, I mostly follow the book EMF Eclipse
> Modeling 2nd Edition. To change the default behavior of the modeled
> classes I extend the default ItemProviders and add custom behavior
> there. To edit the objects I use cell editors. I only use EMF commands
> to change my model. For example:
>
>
> editor.getEditingDomain().getCommandStack().execute(SetCommand.create(editor.getEditingDomain(),item.getData(),
> feature, value));
>
>
> This is the first eclipse plugin that I am developing, and the first
> time I am working with EMF, so my knowledge is quite basic.
>
> Thanks,
> Evica
|
|
|
Re: Undo/Redo Actions Disabled [message #1219985 is a reply to message #1216878] |
Sun, 08 December 2013 06:04  |
Eclipse User |
|
|
|
I finally figured out why the undo/redo actions were disabled in my MultiPageEditor. It turned out that the problem was the default TextEditor ( org.eclipse.ui.editors.text.TextEditor) that I was creating as a last page in my MultiPageEditor. This was disabling my previously enabled undo/redo actions.
Best,
Evica
|
|
|
Powered by
FUDForum. Page generated in 0.06659 seconds