I'd be tempted to put this back in the calling method as we're forcing the page to be a popup so we may as well for the tool property as well and do it all in the same place so it's impossible to get them out of sync.