Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Logic Example and Undo/Redo support
Logic Example and Undo/Redo support [message #213885] Tue, 11 April 2006 15:50 Go to next message
Eclipse UserFriend
Originally posted by: markp.softlanding.com

This is GEF 3.0.

The LogicExample seems to have hooked into the global menu and toolbars
for Undo/Redo. Can you point me to the relevant areas of the code that
make this happen?

I have them on my right-click menu within the editor, but not on the
main menu and toolbar. Those are disabled.

Thanks

Mark
Re: Logic Example and Undo/Redo support [message #214066 is a reply to message #213885] Wed, 12 April 2006 17:42 Go to previous messageGo to next message
Steven R. Shaw is currently offline Steven R. ShawFriend
Messages: 128
Registered: July 2009
Senior Member
Take a look at:

org.eclipse.gef.examples.logicdesigner.actions.LogicActionBa rContributor

-Steve

"Mark Phippard" <markp@softlanding.com> wrote in message
news:e1gj7k$c3l$1@utils.eclipse.org...
> This is GEF 3.0.
>
> The LogicExample seems to have hooked into the global menu and toolbars
> for Undo/Redo. Can you point me to the relevant areas of the code that
> make this happen?
>
> I have them on my right-click menu within the editor, but not on the
> main menu and toolbar. Those are disabled.
>
> Thanks
>
> Mark
Re: Logic Example and Undo/Redo support [message #214129 is a reply to message #214066] Wed, 12 April 2006 19:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: markp.softlanding.com

Steven Shaw wrote:

> Take a look at:
>
> org.eclipse.gef.examples.logicdesigner.actions.LogicActionBa rContribut
> or

Thanks. I took a look and copied the relevant bits. However, the
toolbar and menu options still do not enable after changes are made.
The right-click menu options still work fine. So it seems like there
must be other bits in the example that control this.

Any ideas?

Mark
Re: Logic Example and Undo/Redo support [message #214201 is a reply to message #214129] Thu, 13 April 2006 20:30 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tom.seidel.javawiki.org

Mark Phippard wrote:
> Steven Shaw wrote:
>
>> Take a look at:
>>
>> org.eclipse.gef.examples.logicdesigner.actions.LogicActionBa rContribut
>> or
>
> Thanks. I took a look and copied the relevant bits. However, the
> toolbar and menu options still do not enable after changes are made.
> The right-click menu options still work fine. So it seems like there
> must be other bits in the example that control this.
>
> Any ideas?
>
> Mark

Hi Mark,

You're manipulating the GEF-Diagram with different Commands, right?-Then
you have to implement for every command an undo and a redo action by
overwriting #undo(), #redo() and #canUndo(). All executed commands are
on the command-stack an can be undone if the #canUndo() - method of the
special command returns true.

Cheerz,
Tom
Re: Logic Example and Undo/Redo support [message #214249 is a reply to message #214201] Fri, 14 April 2006 14:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: markp.softlanding.com

Tom Seidel wrote:

> You're manipulating the GEF-Diagram with different Commands,
> right?-Then you have to implement for every command an undo and a
> redo action by overwriting #undo(), #redo() and #canUndo(). All
> executed commands are on the command-stack an can be undone if the
> #canUndo() - method of the special command returns true.

That is just how you enable undo/redo in your model. I have that
working fine. What I am asking is a UI issue. How do I get the
Eclipse IDE undo/redo menu and toolbar enabled and connected to my
code? The Logic example appears to do it. Right now, I have to
right-click in my diagram to get to the options. I just want the other
ones enabled too.

I have done it before via brute force, but it seems like the logic
example might have a better way. I just cannot figure it out.

This is in 3.0

Mark
Re: Logic Example and Undo/Redo support [message #214273 is a reply to message #214249] Fri, 14 April 2006 15:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tom.seidel.javawiki.org

Mark Phippard wrote:
> Tom Seidel wrote:
>
>> You're manipulating the GEF-Diagram with different Commands,
>> right?-Then you have to implement for every command an undo and a
>> redo action by overwriting #undo(), #redo() and #canUndo(). All
>> executed commands are on the command-stack an can be undone if the
>> #canUndo() - method of the special command returns true.
>
> That is just how you enable undo/redo in your model. I have that
> working fine. What I am asking is a UI issue. How do I get the
> Eclipse IDE undo/redo menu and toolbar enabled and connected to my
> code? The Logic example appears to do it. Right now, I have to
> right-click in my diagram to get to the options. I just want the other
> ones enabled too.
>
> I have done it before via brute force, but it seems like the logic
> example might have a better way. I just cannot figure it out.
>
> This is in 3.0
>
> Mark

Have you declared the contributor-class in your plugin.xml?

Tom
Re: Logic Example and Undo/Redo support [message #214281 is a reply to message #214273] Fri, 14 April 2006 17:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: markp.softlanding.com

Tom Seidel wrote:

> Have you declared the contributor-class in your plugin.xml?

I am not sure what you mean. I look at the logic example XML and all I
see is it contributing a Print action and the stuff to declare the
editor itself and the New wizard.

Mark
Re: Logic Example and Undo/Redo support [message #214289 is a reply to message #214281] Fri, 14 April 2006 17:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: markp.softlanding.com

Mark Phippard wrote:

> Tom Seidel wrote:
>
> > Have you declared the contributor-class in your plugin.xml?
>
> I am not sure what you mean. I look at the logic example XML and all
> I see is it contributing a Print action and the stuff to declare the
> editor itself and the New wizard.

Disregard. I see it now.

I will give it a try.

Thanks

Mark
Re: Logic Example and Undo/Redo support [message #214297 is a reply to message #214289] Fri, 14 April 2006 17:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: markp.softlanding.com

Mark Phippard wrote:

> Mark Phippard wrote:
>
> > Tom Seidel wrote:
> >
> > > Have you declared the contributor-class in your plugin.xml?
> >
> > I am not sure what you mean. I look at the logic example XML and
> > all I see is it contributing a Print action and the stuff to
> > declare the editor itself and the New wizard.
>
> Disregard. I see it now.
>
> I will give it a try.

Actually, it turns out that Yes, I did already have that defined.

Any other ideas?

Mark
Re: Logic Example and Undo/Redo support [message #214536 is a reply to message #214297] Tue, 18 April 2006 10:13 Go to previous messageGo to next message
Sebu Thomas is currently offline Sebu ThomasFriend
Messages: 12
Registered: July 2009
Junior Member
Mark Phippard wrote:
> Mark Phippard wrote:
>
>> Mark Phippard wrote:
>>
>>> Tom Seidel wrote:
>>>
>>>> Have you declared the contributor-class in your plugin.xml?
>>> I am not sure what you mean. I look at the logic example XML and
>>> all I see is it contributing a Print action and the stuff to
>>> declare the editor itself and the New wizard.
>> Disregard. I see it now.
>>
>> I will give it a try.
>
> Actually, it turns out that Yes, I did already have that defined.
>
> Any other ideas?
>
> Mark

Do you have the following in your contributor code?

public void contributeToToolBar(IToolBarManager toolBarManager) {
toolBarManager.add(getActionRegistry().getAction(ActionFacto ry.UNDO.getId()));

toolBarManager.add(getActionRegistry().getAction(ActionFacto ry.REDO.getId()));
...............
}

Also part of contributor

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

And you have registered your contributor class? Look in plugin.xml and
see if you have
<plugin>

<extension
point="org.eclipse.ui.editors">
<editor
class="my.MyEditor"
contributorClass="my.MyContributor"
............
</plugin>
Re: Logic Example and Undo/Redo support [message #214544 is a reply to message #214536] Tue, 18 April 2006 12:39 Go to previous message
Eclipse UserFriend
Originally posted by: markp.softlanding.com

Sebu Thomas wrote:

> Mark Phippard wrote:
> > Mark Phippard wrote:
> >
> > > Mark Phippard wrote:
> > >
> > > > Tom Seidel wrote:
> > > >
> > > > > Have you declared the contributor-class in your plugin.xml?
> > > > I am not sure what you mean. I look at the logic example XML
> > > > and all I see is it contributing a Print action and the stuff to
> > > > declare the editor itself and the New wizard.
> > > Disregard. I see it now.
> > >
> > > I will give it a try.
> >
> > Actually, it turns out that Yes, I did already have that defined.
> >
> > Any other ideas?
> >
> > Mark
>
> Do you have the following in your contributor code?
>
> public void contributeToToolBar(IToolBarManager toolBarManager) {
> toolBarManager.add(getActionRegistry().getAction(ActionFacto ry.UNDO.ge
> tId()));
> toolBarManager.add(getActionRegistry().getAction(ActionFacto ry.REDO.ge
> tId())); .............. }
>
> Also part of contributor
>
> protected void buildActions() {
> addRetargetAction(new UndoRetargetAction());
> addRetargetAction(new RedoRetargetAction());
> ............
> }
>
> And you have registered your contributor class? Look in plugin.xml
> and see if you have <plugin>
>
> <extension
> point="org.eclipse.ui.editors">
> <editor
> class="my.MyEditor"
> contributorClass="my.MyContributor"
> ...........
> </plugin>

Yes, I had all of that. I finally got it working. I was doing a
couple of other things in my contributor class. I think one of these
was interefering with something or causing a side-effect. I
reorganized some of that code and then this started working.

Thanks

Mark
Previous Topic:using draw2d in a RCP app
Next Topic:Verify input to direct edit
Goto Forum:
  


Current Time: Thu Apr 25 15:07:12 GMT 2024

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

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

Back to the top