Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Enabling/Disabling Interdependant Actions
Enabling/Disabling Interdependant Actions [message #461191] Sat, 06 January 2007 10:54 Go to next message
Frederic Conrotte is currently offline Frederic ConrotteFriend
Messages: 125
Registered: July 2009
Senior Member
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 19:42 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

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 18:22 Go to previous message
Frederic Conrotte is currently offline Frederic ConrotteFriend
Messages: 125
Registered: July 2009
Senior Member
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: Fri Apr 19 21:13:32 GMT 2024

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

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

Back to the top