I get this problem when I'm doing an external compile (
maven) that fails. Eclipse gets totally confused even after I fix the problem and compile clean.
I don't have a totally cookbook solution, but stopping and restarting Eclipse is a start along with a Refresh operation. Usually that doesn't fix a whole lot, however, since apparently there's some scrambled project metadata. Often "touching" a module will make it recover. I suppose a manual Eclipse "rebuild" might help, but I haven't tried.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.