Added NewResourceDialog to encapsulate those functionality.

Will do this for all popups.