Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to SET an parameter for a command
How to SET an parameter for a command [message #467790] Thu, 10 May 2007 18:53 Go to next message
Marc Schlegel is currently offline Marc SchlegelFriend
Messages: 92
Registered: July 2009
Member
Hi experts

I am trying to get familiar with this commands from Eclipse 3.3

I know how to create a command, handle return values and so but I don't
know how to set a parameter for a command.

I defined my command as follows
------------------------------------
<command

defaultHandler=" toolseye.vehiclemanagement.actions.DeleteVehicleCommandHandl er "
description="Action to delete a selection of Vehicles"
id="toolseye.vehiclemanagement.deleteVehicleCommand"
name="toolseye.vehiclemanagement.deleteVehicleCommand">
<commandParameter

id=" toolseye.vehiclemanagement.deleteVehicleCommand.selectionPar am "
name="Selection"
optional="false"
values="org.eclipse.jface.viewers.IStructuredSelection">
</commandParameter>
</command>
------------------------------------

My problem is, that I can't find any method where I can set the value
for my IStructuredSelection?

Thx
-- Marc
Re: How to SET an parameter for a command [message #467802 is a reply to message #467790] Thu, 10 May 2007 19:03 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

It's not that kind of parameter, it tends to be more static information.
For example a toggle context command, where you create a Toggle
Context1 button and a Toggle Context2 button. Context1 and Context2 fit
well with the command parameterization scheme.

For the selection, you can use HandlerUtil.getCurrentSelection(event) to
get the current selection within your handler execute(*) method. Before
3.3 you could extract the current selection using the
event.getApplicationContext() and an ISources constant.

Subclass org.eclipse.core.commands.AbstractHandler if you have the option.


Later,
PW


Re: How to SET an parameter for a command [message #467803 is a reply to message #467802] Thu, 10 May 2007 19:16 Go to previous message
Marc Schlegel is currently offline Marc SchlegelFriend
Messages: 92
Registered: July 2009
Member
Wow, sounds difficult and I don't get it ^^

In my case the selection comes from a ListViewer. The view containing
this viewer executes the command and my problem now is how to tell the
command which elements are selected?

Thanks again
-- Marc

Paul Webster schrieb:
> It's not that kind of parameter, it tends to be more static information.
> For example a toggle context command, where you create a Toggle
> Context1 button and a Toggle Context2 button. Context1 and Context2 fit
> well with the command parameterization scheme.
>
> For the selection, you can use HandlerUtil.getCurrentSelection(event) to
> get the current selection within your handler execute(*) method. Before
> 3.3 you could extract the current selection using the
> event.getApplicationContext() and an ISources constant.
>
> Subclass org.eclipse.core.commands.AbstractHandler if you have the option.
>
>
> Later,
> PW
Previous Topic:Binding commands to IActionDelegate in context menus
Next Topic:Programmatically minimize view stack to trim
Goto Forum:
  


Current Time: Thu Apr 25 16:17:12 GMT 2024

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

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

Back to the top