To sum up all all that Remy said in that bug:
the reason my two lines of code didn't work (call to setSize() and
layout() methods of the shell) is because the button bar containing ok and
cancel buttons doesn't exist at the time of the call. It does what it is
supposed to do but only with dialog area that is created.
Once again thank you Remy for your help.