Okay, time for forced focus. It's time to go full screen.
This is the world's simplest focus technique I know: just hide everything else.
I close the window blinds. I turn off the monitor on my other machine. Most importantly, I put the window I'm working in on full screen mode. That way I can't see anything but what I'm working on. It's similar to tools like WriteRoom, but in this case it's for my IDE.
When you really want to focus, but can't, consider going full screen. It almost always helps me.