Added AdapterUtils.adaptToAnyResource() to avoid programming mistakes
Unfortunately getAdapter(IResource.class) does not, as one would naively
expect, return an IProject objects if the implementation simply provides
only dedicated adapters for IFile or IProject or IContainer types. In
many cases on the caller side we don't care and just want *anything*
extending IResource, independently which adapter is implemented on the
object side.
Proposed AdapterUtils.adaptToAnyResource(Object) checks if the object is
an instance of or has adapter to IResource, IFile, IProject or
IContainer, so that there is no need anymore to write this boilerplate
code. The related client code is adopted where needed.
Change-Id: Ic9ae4eae707640665dcac1ce5dab2d24ab320e38
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
12 files changed: