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
}
		GC gc = new GC(item.getParent());
		int maxWidth = item.getImage().getBounds().width * 4;
		if (gc.textExtent(textValue).x < maxWidth) {
			gc.dispose();
			return textValue;
		}
		for (int i = textValue.length(); i > 0; i--) {
			String test = textValue.substring(0, i);
			test = test + ellipsis;
			if (gc.textExtent(test).x < maxWidth) {
				gc.dispose();
				return test;
			}
		}
		gc.dispose();
		
		return textValue;
	}
	/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.jface.action.ContributionItem#dispose()
	 */
	public void dispose() {
		if (widget != null) {
			widget.dispose();
			widget = null;
		}
		holdMenu = null;