Suppose your file browser can return also other information that can be set in the image dialog (like link url, target etc.). One can imagine even a custom dialog with unknown fields that could be updated by a file browser.

It seems that the right way to go would be to allow passing a callback function to the setUrl function in the filebrowser plugin. This way we could do something like: