Added more checks before processing a resource

Now it should exist, be a file and have a java like extension.

(I don't know, but I expect this to include groovy if you have such
handling installed - if not that will require extra handling.)

Also checks before clearing so will stop project close causing exceptions.

fixes #42