Yea, I've realized that once the function returns the workspace is completely setup, its just the events that are occurring asynchronously.
The goal is to know when all of the events have been fired. When events fire I use that to determine if I should save. My issue has been that when I load a program I was calling my "save" function multiple times as the events triggered from domToWorkspace occur. As the events occur they build up state in my application, so if I call "save" before all the triggered events have been called I end up calling "save" with incomplete data, and then eventually with the correct original data that was loaded. Its the intermediate calls to "save" that are messing things up higher up in my application.
I need to be able to know when all the creation events that were caused by loading a workspace are done so that I can resume calling my "save" function like normal.
Using a setTimeout and calling "fireChangeListener" myself to know when the events are finished has been the easiest way to work through this (and may be the correct way?)
I just didn't find anything in the code that seemed to address this situation so I thought I'd ask!
Thanks!
Nick