|
|
|
|
|
|
|
Re: What is that drop-down Coolbar button widget? - The answer... [message #447703 is a reply to message #447656] |
Thu, 16 December 2004 10:27 |
h1055071 Messages: 335 Registered: July 2009 |
Senior Member |
|
|
I based mine on
org.eclipse.team.internal.ui.synchronize.actions.Synchronize PageDropDownAction
where they do the same, return null. I put a breakpoint there and found
that getMenu(Menu) is never called.
Now all I need to do is figure out how to get the menu to drop down when I
click the actual button (as well as the little arrow.)
Phil
"Stefan Pietsch" <pietsch@multichart.de> wrote in message
news:cprebq$tci$1@www.eclipse.org...
> Hi Phillip,
>
> thanks for your example. I came to the same solution.
>
> But your method getMenu(Menu) returns null. Have you an idea how I can
> fill
> this method, without construvting the same menu like getMenu(Control)
> twice?
>
> Bye Stefan
>
> "Phillip Beauvoir" <p.beauvoir@bolton.ac.uk> schrieb im Newsbeitrag
> news:cpqlpd$n2p$1@www.eclipse.org...
>> For anyone who's interested I found out how to do it with the following
>> class (replace your own actions). I don't know if this is the best way
>> to
>> do it, but it works:
>>
>> public class NewDropDownAction extends Action implements IMenuCreator {
>> private Menu _menu;
>>
>> public NewDropDownAction() {
>> super("New", SWT.DROP_DOWN);
>> setToolTipText("New");
>> setMenuCreator(this);
>> }
>>
>> public void dispose() {
>> if(_menu != null) {
>> _menu.dispose();
>> _menu = null;
>> }
>> }
>>
>> public Menu getMenu(Control parent) {
>> if(_menu != null) {
>> _menu.dispose();
>> }
>> _menu = new Menu(parent);
>> ActionContributionItem item = new
>> ActionContributionItem(yourAction);
>> item.fill(_menu, -1);
>> item = new ActionContributionItem(anotherAction);
>> item.fill(_menu, -1);
>> return _menu;
>> }
>>
>> public Menu getMenu(Menu parent) {
>> return null;
>> }
>> }
>>
>>
>> "Phillip Beauvoir" <p.beauvoir@bolton.ac.uk> wrote in message
>> news:cppp50$sa2$1@www.eclipse.org...
>> > Hi, can anyone tell me what the widget is that allows menu sub-buttons
> to
>> > be added to a parent coolbar button - looks like a combo box, and is
> used
>> > for the New Project button in the IDE.
>> >
>> > Thanks!
>> >
>> > Phil
>> >
>> >
>>
>>
>
>
|
|
|
Re: What is that drop-down Coolbar button widget? - The answer... [message #447704 is a reply to message #447703] |
Thu, 16 December 2004 12:47 |
Stefan Pietsch Messages: 68 Registered: July 2009 |
Member |
|
|
Hi Phil,
you need getMenu(Menu) if you insert the same action a menubar and a
toolbar! With my toolbar everything works fine, but the menu does not.
Bye Stefan
"Phillip Beauvoir" <p.beauvoir@bolton.ac.uk> schrieb im Newsbeitrag
news:cpro7g$uvh$1@www.eclipse.org...
> I based mine on
>
org.eclipse.team.internal.ui.synchronize.actions.Synchronize PageDropDownActi
on
> where they do the same, return null. I put a breakpoint there and found
> that getMenu(Menu) is never called.
>
> Now all I need to do is figure out how to get the menu to drop down when I
> click the actual button (as well as the little arrow.)
>
> Phil
>
>
> "Stefan Pietsch" <pietsch@multichart.de> wrote in message
> news:cprebq$tci$1@www.eclipse.org...
> > Hi Phillip,
> >
> > thanks for your example. I came to the same solution.
> >
> > But your method getMenu(Menu) returns null. Have you an idea how I can
> > fill
> > this method, without construvting the same menu like getMenu(Control)
> > twice?
> >
> > Bye Stefan
> >
> > "Phillip Beauvoir" <p.beauvoir@bolton.ac.uk> schrieb im Newsbeitrag
> > news:cpqlpd$n2p$1@www.eclipse.org...
> >> For anyone who's interested I found out how to do it with the following
> >> class (replace your own actions). I don't know if this is the best way
> >> to
> >> do it, but it works:
> >>
> >> public class NewDropDownAction extends Action implements IMenuCreator {
> >> private Menu _menu;
> >>
> >> public NewDropDownAction() {
> >> super("New", SWT.DROP_DOWN);
> >> setToolTipText("New");
> >> setMenuCreator(this);
> >> }
> >>
> >> public void dispose() {
> >> if(_menu != null) {
> >> _menu.dispose();
> >> _menu = null;
> >> }
> >> }
> >>
> >> public Menu getMenu(Control parent) {
> >> if(_menu != null) {
> >> _menu.dispose();
> >> }
> >> _menu = new Menu(parent);
> >> ActionContributionItem item = new
> >> ActionContributionItem(yourAction);
> >> item.fill(_menu, -1);
> >> item = new ActionContributionItem(anotherAction);
> >> item.fill(_menu, -1);
> >> return _menu;
> >> }
> >>
> >> public Menu getMenu(Menu parent) {
> >> return null;
> >> }
> >> }
> >>
> >>
> >> "Phillip Beauvoir" <p.beauvoir@bolton.ac.uk> wrote in message
> >> news:cppp50$sa2$1@www.eclipse.org...
> >> > Hi, can anyone tell me what the widget is that allows menu
sub-buttons
> > to
> >> > be added to a parent coolbar button - looks like a combo box, and is
> > used
> >> > for the New Project button in the IDE.
> >> >
> >> > Thanks!
> >> >
> >> > Phil
> >> >
> >> >
> >>
> >>
> >
> >
>
>
|
|
|
Re: What is that drop-down Coolbar button widget? - The answer... [message #447706 is a reply to message #447704] |
Thu, 16 December 2004 13:24 |
h1055071 Messages: 335 Registered: July 2009 |
Senior Member |
|
|
Can you just copy the code from getMenu(Control parent)?
Phil
"Stefan Pietsch" <pietsch@multichart.de> wrote in message
news:cps04h$pmb$1@www.eclipse.org...
> Hi Phil,
>
> you need getMenu(Menu) if you insert the same action a menubar and a
> toolbar! With my toolbar everything works fine, but the menu does not.
>
> Bye Stefan
>
> "Phillip Beauvoir" <p.beauvoir@bolton.ac.uk> schrieb im Newsbeitrag
> news:cpro7g$uvh$1@www.eclipse.org...
>> I based mine on
>>
> org.eclipse.team.internal.ui.synchronize.actions.Synchronize PageDropDownActi
> on
>> where they do the same, return null. I put a breakpoint there and found
>> that getMenu(Menu) is never called.
>>
>> Now all I need to do is figure out how to get the menu to drop down when
>> I
>> click the actual button (as well as the little arrow.)
>>
>> Phil
>>
>>
>> "Stefan Pietsch" <pietsch@multichart.de> wrote in message
>> news:cprebq$tci$1@www.eclipse.org...
>> > Hi Phillip,
>> >
>> > thanks for your example. I came to the same solution.
>> >
>> > But your method getMenu(Menu) returns null. Have you an idea how I can
>> > fill
>> > this method, without construvting the same menu like getMenu(Control)
>> > twice?
>> >
>> > Bye Stefan
>> >
>> > "Phillip Beauvoir" <p.beauvoir@bolton.ac.uk> schrieb im Newsbeitrag
>> > news:cpqlpd$n2p$1@www.eclipse.org...
>> >> For anyone who's interested I found out how to do it with the
>> >> following
>> >> class (replace your own actions). I don't know if this is the best
>> >> way
>> >> to
>> >> do it, but it works:
>> >>
>> >> public class NewDropDownAction extends Action implements IMenuCreator
>> >> {
>> >> private Menu _menu;
>> >>
>> >> public NewDropDownAction() {
>> >> super("New", SWT.DROP_DOWN);
>> >> setToolTipText("New");
>> >> setMenuCreator(this);
>> >> }
>> >>
>> >> public void dispose() {
>> >> if(_menu != null) {
>> >> _menu.dispose();
>> >> _menu = null;
>> >> }
>> >> }
>> >>
>> >> public Menu getMenu(Control parent) {
>> >> if(_menu != null) {
>> >> _menu.dispose();
>> >> }
>> >> _menu = new Menu(parent);
>> >> ActionContributionItem item = new
>> >> ActionContributionItem(yourAction);
>> >> item.fill(_menu, -1);
>> >> item = new ActionContributionItem(anotherAction);
>> >> item.fill(_menu, -1);
>> >> return _menu;
>> >> }
>> >>
>> >> public Menu getMenu(Menu parent) {
>> >> return null;
>> >> }
>> >> }
>> >>
>> >>
>> >> "Phillip Beauvoir" <p.beauvoir@bolton.ac.uk> wrote in message
>> >> news:cppp50$sa2$1@www.eclipse.org...
>> >> > Hi, can anyone tell me what the widget is that allows menu
> sub-buttons
>> > to
>> >> > be added to a parent coolbar button - looks like a combo box, and is
>> > used
>> >> > for the New Project button in the IDE.
>> >> >
>> >> > Thanks!
>> >> >
>> >> > Phil
>> >> >
>> >> >
>> >>
>> >>
>> >
>> >
>>
>>
>
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.05194 seconds