Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Creating menu items at runtime
Creating menu items at runtime [message #948818] Thu, 18 October 2012 12:05 Go to next message
Gennady Gromov is currently offline Gennady GromovFriend
Messages: 24
Registered: May 2011
Junior Member
Hello, all!

I tried to add new menu item dynamically to the "File" menu of the main menu:

MDirectMenuItem item = MMenuFactory.INSTANCE.createDirectMenuItem();
item.setLabel("LABEL");
fileMenu.getChildren().add(item);

After execution of this code, there is no result. The main menu is unchanged. This code I read in tuorials.
May be it is necessary to execute something else to force updating the menu?

I tried to add

item.setToBeRendered(true);

item.setVisible(true);

E4Workbench.processHierarchy(application);


no effect.

[Updated on: Thu, 18 October 2012 12:18]

Report message to a moderator

Re: Creating menu items at runtime [message #948830 is a reply to message #948818] Thu, 18 October 2012 12:20 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 5487
Registered: July 2009
Senior Member
Please search the newsgroup! This is a bug in the menu renderer code.

Tom

Am 18.10.12 14:05, schrieb Gennady Gromov:
> Hello, all!
>
> I tried to add new menu item dynamically to the "File" menu of the main
> menu:
>
> MDirectMenuItem item = MMenuFactory.INSTANCE.createDirectMenuItem();
> item.setLabel("LABEL");
> fileMenu.getChildren().add(item);
>
> After execution of this code, there is no result. The main menu is
> unchanged. This code I read in tuorials.
> May be it is necessary to execute something else to force updating the
> menu?
Previous Topic:Starting command at startup
Next Topic:Dynamically changing the label of a Part
Goto Forum:
  


Current Time: Mon Dec 22 08:43:38 GMT 2014

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

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