replaced addResourceDialog with a better maintainable one