Bug 36446 [Contributions] widgets: Associating Actions with Buttons
Actions can be associated with Menu items , and tool bar items using MenuManager and ToolBarManager but there is not way to associate Action with a regular button and obtaining a reference to that button the closest thing is creating an ActionContributionItem with the desired action in its constructor , then filling the parent composite with ActionContributionItem.fill(Control parent) this creats the button , but it doesn't return a reference to that button , so for example i can't give it any layout data i suggest the ActionContributionItem.fill(Control parent) returns the created widget
bundles/org.eclipse.jface/src/org/eclipse/jface/action/ActionContributionItem.java
};
		MenuItem[] items = realMenu.getItems();
		for (int i = 0; i < items.length; i++) {
			final MenuItem realItem = items[i];
			final MenuItem proxyItem = new MenuItem(proxy, realItem.getStyle());
			proxyItem.setData(realItem);
			proxyItem.setAccelerator(realItem.getAccelerator());
			proxyItem.setEnabled(realItem.getEnabled());
			proxyItem.setImage(realItem.getImage());
			proxyItem.setSelection(realItem.getSelection());
			proxyItem.setText(realItem.getText());
			
			proxyItem.addListener(SWT.Selection, passThrough);
			proxyItem.addListener(SWT.Arm, passThrough);
			proxyItem.addListener(SWT.Help, passThrough);
			final Menu itemMenu = realItem.getMenu();
			if (itemMenu != null) {
				
				final Menu subMenu = new Menu(proxy);
				subMenu.setData(itemMenu);
				proxyItem.setMenu(subMenu);
				subMenu.addListener(SWT.Show, new Listener() {
					public void handleEvent(Event event) {
						event.widget.removeListener(SWT.Show, this);
						if (event.type == SWT.Show) {
							copyMenu(itemMenu, subMenu);
						}
					}
				});
				subMenu.addListener(SWT.Help, passThrough);