Use selection service instead of active editor to get current selection. This is more robust for finding selection in many different kinds of active views.