Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » UndoRedoActionGroup problem
UndoRedoActionGroup problem [message #293057] Mon, 17 October 2005 13:37 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

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


Re: UndoRedoActionGroup problem [message #293073 is a reply to message #293062] Mon, 17 October 2005 16:59 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: UndoRedoActionGroup problem [message #1108799 is a reply to message #293057] Sat, 14 September 2013 11:30 Go to previous message
Phillip Olad is currently offline Phillip OladFriend
Messages: 1
Registered: September 2013
Junior Member
Can you please help me, I am in the same predicament, I didn't quite understand the solution. How do I use the ActionBarContributor subclass? There was no mention of it in the original question
Previous Topic:Play a video in a frame on a welcome page contribution
Next Topic:Toolbar buttons are missing from views after migrating from eclipse 3.6.2 to eclipse 4.2.2
Goto Forum:
  


Current Time: Thu Apr 25 15:27:18 GMT 2024

Powered by FUDForum. Page generated in 0.03219 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top