Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » Using Buttons for triggering Actions
Using Buttons for triggering Actions [message #546569] Tue, 13 July 2010 12:11 Go to next message
Alexey Romanov is currently offline Alexey RomanovFriend
Messages: 263
Registered: May 2010
Senior Member
In my application, I'd like some Actions to be triggered not only by menu items or toolbar buttons, but by normal push buttons as well. Of course, these buttons need to be automatically disabled/enabled/etc. when actions are.

This role for menus and toolbars is played by ContributionManagers, but there doesn't seem to be one for buttons.

There is an obvious approach: create an Action subclass which takes a Button as a constructor parameter and overriding setEnabled/setDisabled/setText/... but is it actually needed or is there a simpler way?

[Updated on: Tue, 13 July 2010 12:24]

Report message to a moderator

Re: A ContributionManager for Buttons [message #546679 is a reply to message #546569] Tue, 13 July 2010 17:33 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

You'd have to write your own subclass of ContributionManager. Something
like org.eclipse.jface.action.StatusLineManager manages
IContributionItems on a Composite, which is similar to what you want.

PW



--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: A ContributionManager for Buttons [message #546683 is a reply to message #546679] Tue, 13 July 2010 18:12 Go to previous message
Alexey Romanov is currently offline Alexey RomanovFriend
Messages: 263
Registered: May 2010
Senior Member
I see, thanks!
Previous Topic:Contents of ComboViewer bigger than its size
Next Topic:TreeViewer refresh
Goto Forum:
  


Current Time: Fri Apr 26 07:22:54 GMT 2024

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

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

Back to the top