Hm, come to think of it - probably don't even need the most recent window for this, if you're just opening a dialog from it. So should be good enough to solely use getEnumerator() and just use the first window that isn't closed.