Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Actions & Parameters
Actions & Parameters [message #492752] Wed, 21 October 2009 15:34 Go to next message
Maurice O'Connor is currently offline Maurice O'ConnorFriend
Messages: 86
Registered: July 2009
Member
Hi!

I have a class MyAction, extending Action, which takes a parameter, so the constructor looks like MyAction(SomeParam foo).

This action is on the context menu of a node on a graph. So I select the node, right click and it appears listed. So far so good.

However, I cannot work out how to execute it - how do I pass the parameter into the constructor? (it is available after querying the current selection).

I understand commands are the new way to do things, but this is old code and I must make do with an action for now.

Thanks!

Maurice

[Updated on: Wed, 21 October 2009 15:34]

Report message to a moderator

Re: Actions & Parameters [message #492819 is a reply to message #492752] Wed, 21 October 2009 20:51 Go to previous messageGo to next message
Christian is currently offline ChristianFriend
Messages: 72
Registered: July 2009
Member
Maurice O'Connor schrieb:
> Hi!
> I have a class extending Action, MyAction, which takes a parameter, so
> the constructor looks like MyAction(SomeParam foo).
>
> This action is on the context menu of a node on a graph. So I select the
> node, right click and it appears listed. So far so good.
>
> However, I cannot work out how to execute it - how do I pass the
> parameter into the constructor? (it is available after querying the
> current selection).
>
> I understand commands are the new way to do things, but this is old code
> and I must make do with an action for now.
>
> Thanks!
>
> Maurice

appears listed though is disabled?

for actions that need selection common pattern is to register the action
with the selection provider..
so implement with the action the correct Selection Changed listener
(register it in the constructor.. unregister it in dispose.. ) and set
the enablement state of the action depending on current selection.

hope I understood you correctly..

Christian
Re: Actions & Parameters [message #493647 is a reply to message #492752] Tue, 27 October 2009 13:20 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Maurice, how did you add it to the context menu? That implies you did a new MyAction(foo), no?

PW


Previous Topic:[DataBinding] Support of Write-Only targets
Next Topic:Remove unwanted menu items
Goto Forum:
  


Current Time: Thu Mar 28 19:58:21 GMT 2024

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

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

Back to the top