title: How do I detect that a SWT dialog has been opened and is visible?
body: <p>I have an SWT <code>WizardDialog</code> with a number of pages. When this dialog first opens I have to do a check for some conditions and if those conditions are met I need to show a popup over the freshly opened dialog.</p>
  
  <p>So I have this code to listen for <code>SWT.Show</code> event. The event listener responds to <code>SWT.Show</code> to conduct its tests and show a message box:</p>
  
  <pre><code>  final WizardDialog dialog = new WizardDialog(shell, wizard);
    dialog.setTitle("New Wizard");
    dialog.create();
    dialog.getShell().addListener(SWT.Show, new Listener()
    {
       private boolean firstShowing = true;
  
       @Override
       public void handleEvent(Event event)
       {
          if (firstShowing &amp;&amp; someConditionExists())
          {
            MessageBox messageBox = new MessageBox(dialog.getShell(), SWT.OK
                   | SWT.ICON_WARNING);
            messageBox.setMessage("Test");
            messageBox.open();
            firstShowing = false;
          }
       }
    });
    dialog.open();
  </code></pre>
  
  <p>Except it's called too soon! The dialog is not visible when the handler is called. My message box appears before the dialog is visible and the dialog only appears when I dismiss the message box.</p>
  
  <p>So clearly the <code>SWT.Show</code> is unreliable, at least on <code>Window</code>s where I'm running it. I've also tried putting this code into a <code>ShellListener</code> on the activation but that happens even before the <code>SWT.Show</code> example above.</p>
  
  <p>So how do I reliably show a message box when the dialog is made visible?</p>
  
  <p>Plan B is a dirty timer based hack where a timer is set to fire 200 ms into the future and hope that it triggers when the dialog is visible but obviously this could introduce it's own issues.</p>