Posts

Showing posts from May, 2010

JFace's IAction and SWT's Button Mapping

Has it ever occurred to you that, you use the IAction/Action as a model for the swt's button widget.

Well there is very simple way of doing it, following steps help you achieve just that:
Create and IAction object  Create the Wrapper around IAction object of ActionContributionItem Call the fill method (there are 3 overridden fill method are present choose as per your requirement) of the class ActionContributionItem passing the parent composite on which you want your button widget to be createdThat's it your button widget is ready with Action model on the backend :)Following are the benefits of keeping the model and UI separate:
You don't have to bother about the state change and propagation of events   You can work on Action object on the back-end which is easier and simpler than working on UI objectsYour UI layer can be automated without worrying about sync problems