Resize a wizard dialog

A quick hint, if anyone is looking for a solution.

Obviously, if you create the wizard dialog by hand, you can use WizardDialog#setPageSize( … ).
However, it is a little bit harder to find when you want to force the size of a page in a wizard created by the platform.
Typically, one of the new wizards (File > New > …).

I got this problem with a TableViewer, on which I had set a TableLayout and forced the width of my columns.
It appeared that the wizard page was not large enough and let a scroll bar in my table.
The best solution was to force the width of my wizard (which had only one page).

Size Not Forced result in the presence of a scroll bar

The solution is in fact quite simple.
Just set the size of the shell in the createControl( Composite ) method.
At the end of this method, I put

// Force the shell size
 Point size = getShell().computeSize( 510, 540 );
 getShell().setSize( size );

Size Forced: no problem

About this entry