Set Connection from Object Explorer

If you wish to switch connection of current SQL Editor window to any database displayed in Object Explorer - just right-click it in Object Explorer and choose "Set as active connection" menu item.
Script Object feature in SSMS