particular solution of $(D^2+4)y=4x^2\cos 2x$ 
Find a particular solution to the equation $$(D^2+4)y=4x^2\cos 2x$$

\begin{align}
y_p&=\frac{1}{D^2+4}(4x^2\cos 2x)\\
&=\frac{1}{D^2+4}\left[2x^2(e^{2ix}+e^{-2ix})\right]\\
&=2\left[e^{2ix}\frac{1}{(D+2i)^2+4}x^2+e^{-2ix}\frac{1}{(D-2i)^2+4}x^2\right]\\
&=2\left[e^{2ix}\frac{1}{D(D+4i)}x^2+e^{-2ix}\frac{1}{D(D-4i)}x^2\right]\\
\end{align}
But I stuck at this point because how to solve $\frac{1}{D(D+4i)}x^2?$ The solution provided this

\begin{align}
&=2\left[e^{2ix}\frac{1}{D(D+4i)}x^2+e^{-2ix}\frac{1}{D(D-4i)}x^2\right]\\&=\frac{1}{4i}\left[e^{2ix}D^{-1}\left(2x^2+ix-\frac{1}{4}\right)-e^{-2ix}D^{-1}\left(2x^2-ix-\frac{1}{4}\right)\right]\\
&=\frac{1}{24}[6x^2\cos 2x+x(8x^2-3)\sin 2x]
\end{align}

I still can't figure out how they do this. Any help will be appreciated.
Update: Using @Isham answer I tired 
\begin{align}
&=\frac{1}{4i}\left[e^{2ix}D^{-1}\left(2x^2+ix-\frac{1}{4}\right)-e^{-2ix}D^{-1}\left(2x^2-ix-\frac{1}{4}\right)\right]\\
&=\frac{1}{4i}\left[e^{2ix}\left(2\frac{x^3}{3}+i\frac{x^2}{2}-\frac{x}{4}\right)-e^{-2ix}\left(2\frac{x^3}{3}-i\frac{x^2}{2}-\frac{x}{4}\right)\right]\\
&=\frac{1}{4i}\left[\frac{2x^3}{3}(e^{2ix}-e^{-2ix})+\frac{x^2i}{2}(e^{2ix}-e^{-2ix})-\frac{x}{4}(e^{2ix}-e^{-2ix})\right]\\
&=\frac{1}{4i}\left[\frac{2x^3}{3}2\cos 2x+\frac{x^2i}{2}2\cos 2x-\frac{x}{4}2\cos 2x\right]
\end{align}
But I think I am again Lost.

A way to do basically the same thing with less weird operator manipulation is to think of the procedure as using the integrating factor method on two first order ODEs. If you have say
$$y''+4y=x^2 e^{2ix}$$
then you can write it as 
$$(D+2i)(D-2i)y=x^2 e^{2ix}.$$
Then you can let $u=(D-2i)y$ and solve $(D+2i)u=x^2 e^{2ix}$ for $u$ by the integrating factor method. So you have
$$e^{2ix} u = \int x^2 e^{4ix} dx$$
which can be evaluated by integrating by parts. Since you just want a particular solution you can set the constant of integration here equal to zero. You wind up with $u$ being some quadratic polynomial times $e^{2ix}$.
Then with $u$ in hand you just solve
$$(D-2i)y=u$$
and get
$$e^{-2ix}y = \int e^{-2ix} u$$
where now the integral winds up being the integral of just a polynomial, because of the "resonance" in the equation. Setting the constant of integration equal to zero again, you wind up with some cubic polynomial with no constant term times $e^{2ix}$.
That said, if you understand how to do this operator shifting trick that you did to pull the $e^{2ix}$ out (I guess $P(D)^{-1} f = e^{ax} P(D+a)^{-1} e^{-ax} f$?), then you can evaluate $\frac{1}{D+4i} x^2$ by just using the geometric series, expanding in powers of $D$. Thus $\frac{1}{D+4i}=\frac{1}{4i} \frac{1}{1+D/4i}=\frac{1}{4i} \sum_{n=0}^\infty (-D/4i)^n$. But now the point is that when you apply this to $x^2$ you get $0$ as soon as $n>2$, so $\frac{1}{D+4i} x^2=\frac{1}{4i} \left ( x^2 - \frac{2x}{4i} + \frac{2}{(4i)^2} \right )$. Then you just apply $D^{-1}$ to that which is just integration.
