Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Command parameters in context menu
Command parameters in context menu [message #1008159] Mon, 11 February 2013 07:35
Jan Kubovy is currently offline Jan KubovyFriend
Messages: 1
Registered: February 2013
Junior Member

I have a tree view and I defined a popup menu for the part the treeview is in. Some of the HandledMenuItems are connected to Commands with parameters. I would like to fill such parameters with a value before the command gets executed depending on the selection of the tree. For example with a resource path stored in the selected item of the tree:

TreeItem selected = tree.getSelection()[0];
IResource resource = (IResource) selected.getData();
String resourcePath = resource.getFullPath().toString();
for (MMenuElement element : contextMenu.getChildren()) {
  if (!(element instanceof MHandledMenuItem))
  MHandledMenuItem item = (MHandledMenuItem) element;
  for (MParameter param : item.getParameters()) {
    if (!param.getName().equals("com.example.commandparameter.resource_path"))

The popup menu is defined under the correct part and is poping up. Just the parameter value is always NULL when it gets executed.

Is there a way how to do that?

I searched but I didn't found how to use parametrized commands with popupmenu.

Thanks for any help!
Previous Topic:How to get view part from Handler
Next Topic:Persisting the Eclipse Application?
Goto Forum:

Current Time: Mon Apr 23 09:57:53 GMT 2018

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

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