Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Submenu using IContextMenuEntry
Submenu using IContextMenuEntry [message #1224554] Fri, 27 December 2013 03:44 Go to next message
Mithu Deb is currently offline Mithu DebFriend
Messages: 9
Registered: September 2013
Junior Member

How do i create submenu within the main menu using IContextMenuEntry for right click
context menu

Kind Regards,
Mithu Deb
Re: Submenu using IContextMenuEntry [message #1228560 is a reply to message #1224554] Tue, 07 January 2014 13:58 Go to previous message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1927
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Hi Mithu Deb,

though it is not explained in the tutorial, the final version of the
tutorial plugin in our SDK shows that. Basically it is overriding the
getContextMenu method in the tool behavior provider with something like
public IContextMenuEntry[] getContextMenu(ICustomContext context) {
// create a sub-menu for all custom features
ContextMenuEntry subMenu = new ContextMenuEntry(null, context);
subMenu.setText("Cu&stom"); //$NON-NLS-1$
subMenu.setDescription("Custom features submenu"); //$NON-NLS-1$
// display sub-menu hierarchical or flat

// create a menu-entry in the sub-menu for each custom feature
ICustomFeature[] customFeatures =
for (int i = 0; i < customFeatures.length; i++) {
ICustomFeature customFeature = customFeatures[i];
if (customFeature.isAvailable(context)) {
ContextMenuEntry menuEntry = new ContextMenuEntry(customFeature,

IContextMenuEntry ret[] = new IContextMenuEntry[] { subMenu };
return ret;

Previous Topic:Routing tutorial
Next Topic:UML Class Diagram Editor based on Graphiti
Goto Forum:

Current Time: Mon Jul 26 20:30:03 GMT 2021

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

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

Back to the top