We present a high energy-resolution inelastic x-ray scattering data investigation of the charge-density-wave (CDW) soft phonon mode upon entering the superconducting state in $2H$-NbSe$_2$. Measurements were done close to the CDW ordering wavevector $mathbf{q}_{CDW}$ at $mathbf{q}=mathbf{q}_{CDW}+(0,0,l)$,$0.15leq l leq 0.5$, for $T=10,rm{K}$ (CDW order) and $3.8,rm{K}$ (CDW order + superconductivity). We observe changes of the phonon lineshape that are characteristic for systems with strong electron-phonon coupling in the presence of a superconducting energy gap $2Delta_c$ and from which we can demonstrate an $l$-dependence of the superconducting gap. Reversely, our data imply that the CDW energy gap is strongly localized along the $c^*$ direction. The confinement of the CDW gap to a very small momentum region explains the rather low competition and easy coexistence of CDW order and superconductivity in $2H$-NbSe$_2$. However, the energy gained by opening $Delta_{CDW}$ seems to be too small to be the driving force of the phase transition at $T_{CDW}=33,rm{K}$ , which is better described as an electron-phonon coupling driven structural phase transition.