UndoRedoActionGroup problem [message #293057] |
Mon, 17 October 2005 13:37 |
Eclipse User |
|
|
|
Originally posted by: hans______.yahoo.com
I am trying to activate the global undo/redo menu items for a specific
EditorPart. This works nicely as long as I let my editor active, but
when I switch to another view in the workspace, the whole undo mechanism
seems to be "forgotten" and only shows deactivated undo/redo actions.
Apparently there is something wrong with the way in which I install the
actions. Does anyone know what I am doing wrong - relevant code is below:
EditorPart myEditor = ...;
IUndoContext undoContext = new ObjectUndoContext(myEditor);
UndoRedoActionGroup group = new UndoRedoActionGroup(myEditor.getSite(),
undoContext, false);
group.fillActionBars(myEditor.getEditorSite().getActionBars( ));
|
|
|
Re: UndoRedoActionGroup problem [message #293062 is a reply to message #293057] |
Mon, 17 October 2005 14:23 |
|
Hans wrote:
> I am trying to activate the global undo/redo menu items for a specific
> EditorPart. This works nicely as long as I let my editor active, but
> when I switch to another view in the workspace, the whole undo mechanism
> seems to be "forgotten" and only shows deactivated undo/redo actions.
> Apparently there is something wrong with the way in which I install the
> actions. Does anyone know what I am doing wrong - relevant code is below:
>
> EditorPart myEditor = ...;
> IUndoContext undoContext = new ObjectUndoContext(myEditor);
> UndoRedoActionGroup group = new UndoRedoActionGroup(myEditor.getSite(),
> undoContext, false);
> group.fillActionBars(myEditor.getEditorSite().getActionBars( ));
If you need to do your action work programmatically, would you not use
ActionBarContributor subclass (that way every time your editor becomes
active, your actions will be activated)?
Later,
PW
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
|
|
|
Re: UndoRedoActionGroup problem [message #293073 is a reply to message #293062] |
Mon, 17 October 2005 16:59 |
Eclipse User |
|
|
|
Originally posted by: hans______.yahoo.com
Paul Webster wrote:
> Hans wrote:
>
>> I am trying to activate the global undo/redo menu items for a specific
>> EditorPart. This works nicely as long as I let my editor active, but
>> when I switch to another view in the workspace, the whole undo
>> mechanism seems to be "forgotten" and only shows deactivated undo/redo
>> actions. Apparently there is something wrong with the way in which I
>> install the actions. Does anyone know what I am doing wrong -
>> relevant code is below:
>>
>> EditorPart myEditor = ...;
>> IUndoContext undoContext = new ObjectUndoContext(myEditor);
>> UndoRedoActionGroup group = new
>> UndoRedoActionGroup(myEditor.getSite(), undoContext, false);
>> group.fillActionBars(myEditor.getEditorSite().getActionBars( ));
>
>
> If you need to do your action work programmatically, would you not use
> ActionBarContributor subclass (that way every time your editor becomes
> active, your actions will be activated)?
Yes, this is working. I am now calling the group's fillActionBars
method each time my ActionContributor's setActiveEditor method is called.
I really appreciate your help - this saved me a lot of time!
Hans
|
|
|
|
Powered by
FUDForum. Page generated in 0.03492 seconds