Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to enable/disable Actions?
How to enable/disable Actions? [message #436350] Tue, 06 September 2005 17:57 Go to next message
Eclipse UserFriend
I have just started developing an RCP application i.e. I'm a newbie.

I've searched for help for hours and just can't figure out a good way to
enable/disable actions. Or rather, I can't figure out how to get
instances of actions.

My app is a simple server management application. I want to have
"Connect" and "Disconnect" buttons on the toolbar for connecting to the
server, and obviously only one of them should be enabled at a time.

I used the RCP mail template that uses private fields in it's
ActionBarAdvisor to store the actions. So I followed the example. The
only way I found of being able to access them later and call
setEnabled(false) was to also give that action instance to my
AbstractUIPlugin subclass (which also stores my custom connection
object). But this doesn't seem like a good design.

Any suggestions?
Re: How to enable/disable Actions? [message #436499 is a reply to message #436350] Fri, 09 September 2005 11:18 Go to previous message
Eclipse UserFriend
I decided to use the Listener pattern for updating the enabled status of
actions based on the status of the server connection. The actions (and
all views that depend on the connection) now implement or create
listeners when they are created. Is this the "right" RCP way to do it?

Erkki Lindpere wrote:
> I have just started developing an RCP application i.e. I'm a newbie.
>
> I've searched for help for hours and just can't figure out a good way to
> enable/disable actions. Or rather, I can't figure out how to get
> instances of actions.
>
> My app is a simple server management application. I want to have
> "Connect" and "Disconnect" buttons on the toolbar for connecting to the
> server, and obviously only one of them should be enabled at a time.
>
> I used the RCP mail template that uses private fields in it's
> ActionBarAdvisor to store the actions. So I followed the example. The
> only way I found of being able to access them later and call
> setEnabled(false) was to also give that action instance to my
> AbstractUIPlugin subclass (which also stores my custom connection
> object). But this doesn't seem like a good design.
>
> Any suggestions?
Previous Topic:How to set caretPosition in a Text on Linux
Next Topic:Deployed RCP Enteprise Applications
Goto Forum:
  


Current Time: Sun Aug 31 08:51:26 EDT 2025

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

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

Back to the top