Passing variables from the runtime code as parameters to command [message #693258] |
Wed, 06 July 2011 02:34  |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.03066 seconds