Programmatic menus [message #336966] |
Thu, 16 July 2009 19:20 |
|
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 |
|
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 |
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.03054 seconds