I would like to create a dialog without the OK/Cancel buttons. I know that if you override the createButton method, this can be achieved.
What do you think of overriding the createButtonBar method to return null if the button bar is not required at all? This would save some code.
Overriding createButtonBar
is going to produce errors if you return null
for the result composite as the Dialog
code expects it to not be null.
You can override createButtonsForButtonBar
and not create any buttons. It looks like Dialog
always checks that individual buttons exist.
You can remove the space used by the buttons composite like this:
@Override
protected void createButtonsForButtonBar(final Composite parent)
{
GridLayout layout = (GridLayout)parent.getLayout();
layout.marginHeight = 0;
}