Casting hurts my brain :)

My suggestion is
```scala
if (resource.isInstanceOf[IFile]) onFileChange(resource.asInstanceOf[IFile]
else eclipseLog.error(s"Expected resource to be of type IFile, found ${resource.getClass}")
```
And you could go one step further and generalize this into an utilitary method that can be used to safely cast.

(The above code might very well not compile, but I think you'll get the idea)