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

Difference between revisions of "CascadingMenu"

(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...)
 
(show menu within menu)
 
Line 1: Line 1:
<nowiki>Insert non-formatted text here</nowiki>== HOw to show menu within menu in GMF? ==
+
==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.
 
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 -
 
The Steps will be -
 
  1. Override the method doExecuteWithResult().
 
  1. Override the method doExecuteWithResult().
  2. Iside the method we would need to call another method createPopupMenu().
+
  2. Inside 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.
 
  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 :-
 
  4. To get the endMenu Contents write a method similar to :-
Line 27: Line 27:
 
   return Collections.EMPTY_LIST;
 
   return Collections.EMPTY_LIST;
 
  }
 
  }
 +
 +
Once you are done with these stpes then go ahead with the normal procedure to call this command in the ContainerNodeEditPolicy of your projetct.
  
 
--[[User:Akhandelwal6.csc.com|arpit.the.star@gmail.com]] 01:36, 7 September 2007 (EDT)
 
--[[User:Akhandelwal6.csc.com|arpit.the.star@gmail.com]] 01:36, 7 September 2007 (EDT)

Latest revision as of 01:41, 7 September 2007

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. Inside 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;
}

Once you are done with these stpes then go ahead with the normal procedure to call this command in the ContainerNodeEditPolicy of your projetct.

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

Back to the top