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 <> { 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.
0 comments:
Post a Comment