Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » View menu with a submenu in an E4 view?
View menu with a submenu in an E4 view? [message #1725053] Mon, 29 February 2016 11:30 Go to next message
Dave Nice is currently offline Dave NiceFriend
Messages: 10
Registered: July 2012
Junior Member
Hi all,

In our last release we rewrote a number of our views to be E4-style.

Previously we had a view menu with a submenu which we want to recreate in the new views but I'm struggling. It looks like the right approach would be to add a MenuManager within the parent view menu MenuManager but in E4 I don't have access to the parent view menu MenuManager.

This is the kind of code I'm writing (we're updating the E4 menu programmatically rather than through a fragment):
		MMenu viewMenu = MMenuFactory.INSTANCE.createMenu();
		viewMenu.setElementId(VIEW_MENU_ID);
		viewMenu.getTags().add("ViewMenu"); //$NON-NLS-1$
		// add menu items here
		viewMenu.getChildren().add(/* child item - ideally a submenu here! */);
		part.getMenus().add(viewMenu);


I want the contents of the submenu to be dynamic.

Does anyone know how this could be done, please? I haven't yet found an example anywhere of a submenu within a view menu for E4.

Dave

[Updated on: Mon, 29 February 2016 11:31]

Report message to a moderator

Re: View menu with a submenu in an E4 view? [message #1725070 is a reply to message #1725053] Mon, 29 February 2016 14:31 Go to previous messageGo to next message
Dave Nice is currently offline Dave NiceFriend
Messages: 10
Registered: July 2012
Junior Member
OK - worked this out in the end. Was very simple so thought I'd post it Smile

Create another MMenu using MMenuFactory.INSTANCE.createMenu() and add it as a child of the original menu.
Re: View menu with a submenu in an E4 view? [message #1725101 is a reply to message #1725070] Mon, 29 February 2016 18:46 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6570
Registered: July 2009
Senior Member
This is NOT public API use EModelService#createElement()

Tom

On 29.02.16 15:31, Dave Nice wrote:
> OK - worked this out in the end. Was very simple so thought I'd post it :)
>
> Create another MMenu using MMenuFactory.INSTANCE.createMenu() and add it
> as a child of the original menu.
Previous Topic:How to add a Composite to a Menu?
Next Topic:Commercial support for RCP 4
Goto Forum:
  


Current Time: Mon Nov 30 09:09:26 GMT 2020

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

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

Back to the top