Skip to main content



      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 02:34 Go to next message
Eclipse UserFriend
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 14:11 Go to previous message
Eclipse UserFriend
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: Sun Jul 06 11:17:26 EDT 2025

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

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

Back to the top