Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Passing variables from the runtime code as parameters to command(I am creating a list of selection events. Bound commands to them. Need to pass variables)
Passing variables from the runtime code as parameters to command [message #693258] Wed, 06 July 2011 06:34 Go to next message
Rajendra Kolli is currently offline Rajendra KolliFriend
Messages: 9
Registered: July 2011
Junior Member
Hi all,

I had created an UI in which a set of buttons are created dynamically, based on the data obtained from an XML file. I have to bind a command to each button that enables the user to create a window dynamically upon clicking the button which shows the details of the selection. I have the command ready and the UI ready. But i need to pass some variables from the runtime code, like the selection id, to make the creation of the window possible.

I have tried searching but couldn't find any solution to the above stated problem. If anyone has a solution to it or another procedure to complete, it would be really helpful.

Thanks,
Rajendra Kolli
Re: Passing variables from the runtime code as parameters to command [message #698075 is a reply to message #693258] Mon, 18 July 2011 18:11 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

If you can serialize the information you need to a string, you can store it parameters in a ParameterizedCommand as part of creating your button.

If it is something more dynamic like application state or a selection (so not directly tied to the button at creation time) you can use org.eclipse.ui.handlers.IHandlerService.getCurrentState() so you can add information to an IEvaluationContext and org.eclipse.ui.handlers.IHandlerService.executeCommandInContext(ParameterizedCommand, Event, IEvaluationContext) to execute your command with that extra information.


PW


Previous Topic:Incorrect behavior when only one command is contributed to the root menu
Next Topic:Key binding in a perspectives
Goto Forum:
  


Current Time: Fri Apr 19 20:12:51 GMT 2024

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

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

Back to the top