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
Hi,

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))
    continue;
  
  MHandledMenuItem item = (MHandledMenuItem) element;
  for (MParameter param : item.getParameters()) {
    if (!param.getName().equals("com.example.commandparameter.resource_path"))
      continue;
    param.setValue(resourcePath);
  }
}


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!
Jan
Previous Topic:Eclipse 4 menu icon size
Next Topic:How to get view part from Handler
Goto Forum:
  


Current Time: Sun Dec 21 19:25:49 GMT 2014

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

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