Ported 'GenerateSwitchLabelsAction'.