EASY TO CREATE A CUSTOM DIALOG? NOOOOO

My goal for today’s PDE programming has been met: Understand how to create a custom dialog in JFace for an Eclipse/Equinox plugin. So, you’d think it would just be as easy as declaring a Dialog-ish object, adding the layout and widgets you need to it and making it visible but its not. It’s not rocket science either, but it is a step back in programming simplicity from what I’m used to. Essentially, there are three steps:

  1. Create your custom Dialog class extending org.eclipse.swt.widgets.Dialog and it’s constructor. Note: so far, this is what I’d expect…
  2. Populate the dialog with widgets, still OK…
  3. Pack() and Open() the dialog and, wait for it…put the parent to sleep!

Whatever happened to convention over configuration? Manually put the parent to sleep in a modal dialog? Take a big one step back for that one. Now that I write about it, it seems simple, but grokking that SWT expects such low-level interactions didn’t sit well with me. One day, soon I hope, when this starts becoming second-nature to me, I’ll laugh at my ignorance. Until then, ever onwards. Hat tip to the Java Examples site for today’s TIP THAT PUT ME OVER THE EDGE.