Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Programmatic menus
Programmatic menus [message #336966] Thu, 16 July 2009 19:20 Go to next message
Dilton McGowan II is currently offline Dilton McGowan IIFriend
Messages: 110
Registered: July 2009
Senior Member
Eclipse 3.4.1, using the code snippet here:

http://wiki.eclipse.org/
FAQ_How_do_I_build_menus_and_toolbars_programmatically%3F

I created an empty view, started Eclipse and used Window | Show View and
no new or changed menus show up? Neither for the main Eclipse menu nor
any local menu for the view.

Is the code no longer applicable?
Re: Programmatic menus [message #336969 is a reply to message #336966] Thu, 16 July 2009 22:50 Go to previous messageGo to next message
Dilton McGowan II is currently offline Dilton McGowan IIFriend
Messages: 110
Registered: July 2009
Senior Member
On Thu, 16 Jul 2009 19:20:30 +0000, Dilton McGowan II wrote:

> Eclipse 3.4.1, using the code snippet here:
>
> http://wiki.eclipse.org/
> FAQ_How_do_I_build_menus_and_toolbars_programmatically%3F
>
> I created an empty view, started Eclipse and used Window | Show View and
> no new or changed menus show up? Neither for the main Eclipse menu nor
> any local menu for the view.
>
> Is the code no longer applicable?

I placed the code from the site into a fresh new view inside
createPartControl() and the menus show nowhere:

IMenuManager mainMenu = getViewSite().getActionBars().getMenuManager();
MenuManager menu1 = new MenuManager("Menu &1", "1");
menu1.add(new Action("Action 1") {});
mainMenu.add(menu1);
MenuManager menu2 = new MenuManager("Menu &2", "2");
menu2.add(new Action("Action 2") {});
menu1.add(menu2);

Is there some extra code needed to make this sample work?
Re: Programmatic menus [message #337000 is a reply to message #336969] Mon, 20 July 2009 15:21 Go to previous message
Dilton McGowan II is currently offline Dilton McGowan IIFriend
Messages: 110
Registered: July 2009
Senior Member
On Thu, 16 Jul 2009 22:50:10 +0000, Dilton McGowan II wrote:

> On Thu, 16 Jul 2009 19:20:30 +0000, Dilton McGowan II wrote:
>
>> Eclipse 3.4.1, using the code snippet here:
>>
>> http://wiki.eclipse.org/
>> FAQ_How_do_I_build_menus_and_toolbars_programmatically%3F
>>
>> I created an empty view, started Eclipse and used Window | Show View
>> and no new or changed menus show up? Neither for the main Eclipse menu
>> nor any local menu for the view.
>>
>> Is the code no longer applicable?
>
> I placed the code from the site into a fresh new view inside
> createPartControl() and the menus show nowhere:
>
> IMenuManager mainMenu =
> getViewSite().getActionBars().getMenuManager(); MenuManager menu1 =
> new MenuManager("Menu &1", "1"); menu1.add(new Action("Action 1") {});
> mainMenu.add(menu1);
> MenuManager menu2 = new MenuManager("Menu &2", "2"); menu2.add(new
> Action("Action 2") {}); menu1.add(menu2);
>
> Is there some extra code needed to make this sample work?

It turns out that you do get a menu in the view via a dinky drop down
arrow button.

Anyone know how to get a real menu ADDED to the actual Eclipse menu
dynamically?

Any help is appreciated.

Thank-you,
Dilton
Previous Topic:Galileo x86_64 OSX crash while printing
Next Topic:Trying to get P2 to work
Goto Forum:
  


Current Time: Mon Dec 30 16:58:11 GMT 2024

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

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

Back to the top