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 09:37 Go to next message
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 10:23 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
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 12:59 Go to previous messageGo to next message
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
Re: UndoRedoActionGroup problem [message #1108799 is a reply to message #293057] Sat, 14 September 2013 07:30 Go to previous message
Phillip Olad is currently offline Phillip Olad
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 Aug 21 18:16:08 EDT 2014

Powered by FUDForum. Page generated in 0.01569 seconds