Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Enabling/Disabling Interdependant Actions
Enabling/Disabling Interdependant Actions [message #461191] Sat, 06 January 2007 05:54 Go to next message
Eclipse UserFriend
Hello,

I've got an RCP application connecting to a JBoss server.

I want to create 2 simple actions: login and logoff.

After creating those 2 actions in the ActionBarAdvisor, I want them to be dependant on some "isLogged()" plugin method, so that I can use the Action.setEnabled(boolean)" method.

If I'm logged in, the "login" action is disabled, the "logoff" action is enabled.
If I'm logged off, the "login" action is enabled, the "logoff" action is disabled.

What's your best way to implement this?

1- Observing a system property?
2- Each action to implement IPropertyListener?
3- Some other way???

The problem is that thru the RCP registry I haven't found any way to access actions after having created them in ActionBarAdvisor.

Something like PlatformUI.getActionSet().getAction(ID) ?

I've looking for such solutions in doc, tutorials and forums but didn't found any clue.

Thanks

Fred
Re: Enabling/Disabling Interdependant Actions [message #461208 is a reply to message #461191] Sat, 06 January 2007 14:42 Go to previous messageGo to next message
Eclipse UserFriend
Based on the way actions are done, when you create each action I would
get it to listen to something that generates an event (even a
PropertyChangeEvent for the "loggedIn" property would be fine).

Then call setEnabled(*) based on the property.

Later,
PW
Re: Enabling/Disabling Interdependant Actions [message #461238 is a reply to message #461208] Sun, 07 January 2007 13:22 Go to previous message
Eclipse UserFriend
Hi,

I've indeed found a good example of the method you describe in the Paperdog project:
http://sourceforge.net/projects/paperdog/

see de.imedic.paperdog.client.internal.core.DogClient.firePostPr opertyChange()
de.imedic.paperdog.client.ui.actions.WorkbenchActionEnabler( )
and de.imedic.paperdog.client.ui.actions.LogoutAction => enabler field

Thanks for your support!

Fred
Previous Topic:forms text control validation
Next Topic:How to set default key bindings?
Goto Forum:
  


Current Time: Wed Mar 26 19:38:38 EDT 2025

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

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

Back to the top