Skip to main content



      Home
Home » Eclipse Projects » GEF » Supporting REDO &UNDO in graphic editor
Supporting REDO &UNDO in graphic editor [message #115846] Thu, 05 February 2004 03:30 Go to next message
Eclipse UserFriend
Originally posted by: sreejaak.yahoo.com

Hi,
I need to support REDO and UNDO in my class that extends
GraphicalEditorWithPalette. I tried the two options
1) Tried using org.eclipse.gef.ui.actions.ActionBarContributor as the
contributorClass. I got an error saying that ActionBarContributor could
not be instantiated.
2) Tried extending ActionBarContributor. In the extended class, I provided
the following methods

protected void buildActions() {
addRetargetAction(new UndoRetargetAction());
addRetargetAction(new RedoRetargetAction());
addRetargetAction(new DeleteRetargetAction());
}

protected void declareGlobalActionKeys() {
addGlobalActionKey(IWorkbenchActionConstants.UNDO);
addGlobalActionKey(IWorkbenchActionConstants.REDO);
}
public void contributeToToolBar(IToolBarManager tbm) {
tbm.add(getAction(IWorkbenchActionConstants.UNDO));
tbm.add(getAction(IWorkbenchActionConstants.REDO));

} public void contributeToMenu(IMenuManager menubar) {
super.contributeToMenu(menubar);
}
I have just one label and one text in the editor. The Undo/Redo menu items
come disabled and the Ctrl-Z, Ctrl-Y commands are not working. What could
I be doing wrong?

Thanks in advance,
Sree
Re: Supporting REDO &UNDO in graphic editor [message #115890 is a reply to message #115846] Thu, 05 February 2004 06:46 Go to previous message
Eclipse UserFriend
Originally posted by: brian.fernandes.codito.com

Have you had a look at how the Logic plugin implements undo and redo ?

It's pretty straight forward, your Commands should have undo and redo
methods (if you don't supply a redo method then the execute method is
called)

Brian.




"Sree" <sreejaak@yahoo.com> wrote in message
news:bvsv03$se3$1@eclipse.org...
> Hi,
> I need to support REDO and UNDO in my class that extends
> GraphicalEditorWithPalette. I tried the two options
> 1) Tried using org.eclipse.gef.ui.actions.ActionBarContributor as the
> contributorClass. I got an error saying that ActionBarContributor could
> not be instantiated.
> 2) Tried extending ActionBarContributor. In the extended class, I provided
> the following methods
>
> protected void buildActions() {
> addRetargetAction(new UndoRetargetAction());
> addRetargetAction(new RedoRetargetAction());
> addRetargetAction(new DeleteRetargetAction());
> }
>
> protected void declareGlobalActionKeys() {
> addGlobalActionKey(IWorkbenchActionConstants.UNDO);
> addGlobalActionKey(IWorkbenchActionConstants.REDO);
> }
> public void contributeToToolBar(IToolBarManager tbm) {
> tbm.add(getAction(IWorkbenchActionConstants.UNDO));
> tbm.add(getAction(IWorkbenchActionConstants.REDO));
>
> } public void contributeToMenu(IMenuManager menubar) {
> super.contributeToMenu(menubar);
> }
> I have just one label and one text in the editor. The Undo/Redo menu items
> come disabled and the Ctrl-Z, Ctrl-Y commands are not working. What could
> I be doing wrong?
>
> Thanks in advance,
> Sree
>
Previous Topic:property sheet on multi selection
Next Topic:FreeformFigure and LayoutManager
Goto Forum:
  


Current Time: Mon May 12 14:10:38 EDT 2025

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

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

Back to the top