It's difficult to tell from your question, but it sounds like you may be attempting to add a ControlContribution to the toolbar and returning a Button. This would make the button on the toolbar appear like a native button like you seem to be describing. This would look something like this:
IToolBarManager toolBarManager = actionBars.getToolBarManager();
toolBarManager.add(new ControlContribution("Toggle Chart") {
@Override
protected Control createControl(Composite parent)
{
Button button = new Button(parent, SWT.PUSH);
button.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
// Perform action
}
});
}
});
Instead you should add an Action to the toolbar. This will create a button on the toolbar that matches the standard eclipse toolbar buttons. This would look something like this:
Action myAction = new Action("", imageDesc) {
@Override
public void run() {
// Perform action
}
};
IToolBarManager toolBarManager = actionBars.getToolBarManager();
toolBarManager.add(myAction);