Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Get lazy main menu items(Problem to get lazy initialized main menu items)
Get lazy main menu items [message #560165] Tue, 21 September 2010 08:17 Go to next message
Roman Ilin is currently offline Roman Ilin
Messages: 1
Registered: September 2010
Junior Member
Hi *,

in my application I have NavigationView with tree component filled by content of 'Workplace' part of main menu.
I used Eclipse RCP 3.2 and that worked just fine.
I get menu like this
MenuItem menuItem = getSite().getShell().getMenuBar().getItem(1);

and with small workaround set it as input for tree component.

Now I try to do the same thing in Helios 3.6 and my navigator tree stays empty because menu items aren't initialized in main menu until first call by user.

Can I change this behavior and load all menu items on application start?

If not then I should probably build this menu part dynamically ContributionItem?

Do you see another options?

Regards
Roman
Re: Get lazy main menu items [message #560185 is a reply to message #560165] Tue, 21 September 2010 09:02 Go to previous message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Roman Ilin wrote:
> Now I try to do the same thing in Helios 3.6 and my navigator tree stays
> empty because menu items aren't initialized in main menu until first
> call by user.
>
> Can I change this behavior and load all menu items on application start?

There might be ways to inject SWT events into the menu and force it
instantiate, but the SWT part of the main menu bar is an implementation
detail. The improvements in lazy loading are what has made your access
to the implementation fail between 3.2 and 3.6.

>
> If not then I should probably build this menu part dynamically
> ContributionItem?

You might be able to, if you could find out what code is generating the
submenu you are interested in. Have a look at
org.eclipse.ui.internal.ide.WorkbenchActionBuilder to see if it is added
to the main menu there.

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Previous Topic:Impossible to mock PlatformUI ?
Next Topic:Zoom in view?
Goto Forum:
  


Current Time: Sat Aug 30 16:26:28 EDT 2014

Powered by FUDForum. Page generated in 0.05947 seconds