Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

CascadingMenu

Revision as of 01:37, 7 September 2007 by Akhandelwal6.csc.com (Talk | contribs) (New page: <nowiki>Insert non-formatted text here</nowiki>== HOw to show menu within menu in GMF? == To get nested menus while dragging a connection out from a node in GMF we need to make our own com...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Insert non-formatted text here== HOw to show menu within menu in GMF? == To get nested menus while dragging a connection out from a node in GMF we need to make our own command that extends PopupMenuCommand.

The Steps will be -

1. Override the method doExecuteWithResult().
2. Iside the method we would need to call another method createPopupMenu().
3. To populate the contents of the popupmenu we need the connection and endMenu contents.
4. To get the endMenu Contents write a method similar to :-
protected List getEndMenuContent(Object connectionItem) {
  ModelingAssistantService mInstance = ModelingAssistantService.getInstance();
  if (connectionItem instanceof IElementType) {
  IElementType connectionType = (IElementType) connectionItem;
  List returneMe   = new ArrayList();
  List menuContent = mInstance.getTypesForTarget(getKnownEnd(),connectionType);
  for (int i = 0; i < menuContent.size(); i++) {
  if (menuContent.get(i) instanceof IElementType) {
  returneMe.add(menuContent.get(i));
  }else 
  {returneMe.add(new PopupMenu.CascadingMenu({name of the catrgory},
  new PopupMenu((List) (menuContent.get(i)),
  getConnectionAndEndLabelProvider(menuContent.get(i)))));
  }
  }
  returneMe.add(EXISTING_ELEMENT);
  return returneMe;
 }
 return Collections.EMPTY_LIST;
}

--arpit.the.star@gmail.com 01:36, 7 September 2007 (EDT)

Back to the top