Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Toggle Button on the EditorToolbar
Toggle Button on the EditorToolbar [message #109935] Tue, 23 December 2003 19:20 Go to next message
Eclipse UserFriend
Originally posted by: brian.fernandes.codito.com

I added a button to my editors toolbar just like in the Logic example.. by
extening RetargetAction.

This button functions like a push button; you push it and it pops back out
again...

I want a Toggle button - click once and it gets depressed, click again and
it pops out again.

If you create a button using an editor extension point, I think you can
specify that you want a toggle style button... the constructor for the
Action class also allows a style parameter but this is not visible at
RetargetAction.

So am I supposed to implement the toggle logic manually but keeping the
button pressed (how do I do this) depending on some state variables ?

Thanks,
Brian.
Re: Toggle Button on the EditorToolbar [message #109943 is a reply to message #109935] Tue, 23 December 2003 20:33 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
new RetargetAction("id", "name", IAction.AS_CHECK_BOX)

"Brian Fernandes" <brian.fernandes@codito.com> wrote in message
news:bsa3l8$dqv$1@eclipse.org...
> I added a button to my editors toolbar just like in the Logic example.. by
> extening RetargetAction.
>
> This button functions like a push button; you push it and it pops back out
> again...
>
> I want a Toggle button - click once and it gets depressed, click again and
> it pops out again.
>
> If you create a button using an editor extension point, I think you can
> specify that you want a toggle style button... the constructor for the
> Action class also allows a style parameter but this is not visible at
> RetargetAction.
>
> So am I supposed to implement the toggle logic manually but keeping the
> button pressed (how do I do this) depending on some state variables ?
>
> Thanks,
> Brian.
>
>
>
>
Re: Toggle Button on the EditorToolbar [message #109969 is a reply to message #109943] Wed, 24 December 2003 02:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

I wonder if both the retarget action, and the action handler (another
action) both have to have the checkbox style? Seems redundant.

"Pratik Shah" <ppshah@us.ibm.com> wrote in message
news:bsa8q4$jhi$1@eclipse.org...
> new RetargetAction("id", "name", IAction.AS_CHECK_BOX)
>
> "Brian Fernandes" <brian.fernandes@codito.com> wrote in message
> news:bsa3l8$dqv$1@eclipse.org...
> > I added a button to my editors toolbar just like in the Logic example..
by
> > extening RetargetAction.
> >
> > This button functions like a push button; you push it and it pops back
out
> > again...
> >
> > I want a Toggle button - click once and it gets depressed, click again
and
> > it pops out again.
> >
> > If you create a button using an editor extension point, I think you can
> > specify that you want a toggle style button... the constructor for the
> > Action class also allows a style parameter but this is not visible at
> > RetargetAction.
> >
> > So am I supposed to implement the toggle logic manually but keeping the
> > button pressed (how do I do this) depending on some state variables ?
> >
> > Thanks,
> > Brian.
> >
> >
> >
> >
>
>
Re: Toggle Button on the EditorToolbar [message #109983 is a reply to message #109943] Wed, 24 December 2003 05:29 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: brian.fernandes.codito.com

"Pratik Shah" <ppshah@us.ibm.com> wrote in message
news:bsa8q4$jhi$1@eclipse.org...
> new RetargetAction("id", "name", IAction.AS_CHECK_BOX)

I don't know if I'm missing something obvious here; but RetargetAction has a
single constructor which takes two String arguments. You've mentioned a
third integer argument ... to RetargetAction ?
Re: Toggle Button on the EditorToolbar [message #110045 is a reply to message #109983] Wed, 24 December 2003 21:45 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
Aah, yes, the comment for that constructor says that it was introduced in
3.0. So, I am guessing you have a version older than that. In the older
version, you might be able to extend RetargetAction and specify the style:
IAction.AS_CHECK_BOX. Or maybe just specifying this style on your original
action would do the trick.


"Brian Fernandes" <brian.fernandes@codito.com> wrote in message
news:bsb79v$bbp$1@eclipse.org...
>
> "Pratik Shah" <ppshah@us.ibm.com> wrote in message
> news:bsa8q4$jhi$1@eclipse.org...
> > new RetargetAction("id", "name", IAction.AS_CHECK_BOX)
>
> I don't know if I'm missing something obvious here; but RetargetAction has
a
> single constructor which takes two String arguments. You've mentioned a
> third integer argument ... to RetargetAction ?
>
>
Re: Toggle Button on the EditorToolbar [message #110058 is a reply to message #110045] Thu, 25 December 2003 09:39 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: brianv.phreaker.net

Sorry for not mentioning my Eclipse version; but I checked in Eclipse 3M5
and it wasn't there ...

So I guess it was added in the recently released M6 ?? (hooray ! for once I
acutally must use
bleeding edge technology ;)

But if I use the new constructor ... then I suppose my plugin will not work
perfectly on 2.1.1 platforms anymore ? So far I have been developing using
Eclipse 3M2, but my users use the 2.1.2 platforms and no problems have come
up...

Specifiing the style for my original action faces the same problem as the
RetargetAction. I've extended EditPartAction and again the style can only
be specified in the Action class constructor. The classes subclassing Action
leave out the style parameter. Will check in M6 though. :(

Thanks & Merry Christmas,
Brian.
Re: Toggle Button on the EditorToolbar [message #110094 is a reply to message #109983] Mon, 29 December 2003 02:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

calling setValue(false) or something like that has the side-effect of
setting the AS_CHECK_BOX style.
I'm not sure that it makes sense for the RetargetAction to have any style at
all. Ideally it should inherit the style from it's action handler. But,
alas the limitation of SWT require you to set the SWT.CHECK style at the
time when MenuItem is constructed. So I guess you probably could call a
bogus setValue. Can you find examples of boolean retarget action (JDT
perhaps?) in 2.1 or whatever version you are on?

"Brian Fernandes" <brian.fernandes@codito.com> wrote in message
news:bsb79v$bbp$1@eclipse.org...
>
> "Pratik Shah" <ppshah@us.ibm.com> wrote in message
> news:bsa8q4$jhi$1@eclipse.org...
> > new RetargetAction("id", "name", IAction.AS_CHECK_BOX)
>
> I don't know if I'm missing something obvious here; but RetargetAction has
a
> single constructor which takes two String arguments. You've mentioned a
> third integer argument ... to RetargetAction ?
>
>
Re: Toggle Button on the EditorToolbar [message #110237 is a reply to message #110094] Mon, 29 December 2003 21:36 Go to previous message
Eclipse UserFriend
Originally posted by: brian.fernandes.codito.com

Thanks Randy,
Calling setChecked(false) in the RetargetAction does make it a check_box
styled button.

I agree, the retarget action should inherit it's properties from the action
handler - the current implementation is quite ambiguou - in M6, I believe
you can set the style of the RetargetAction directly as Pratik says; but
that increases the ambiguity when both actions have different styles.

Brian.
Previous Topic:anti-aliasing again
Next Topic:dotted lines
Goto Forum:
  


Current Time: Thu Dec 26 14:26:53 GMT 2024

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

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

Back to the top