Hi,
What is the easiest way of converting a package name such as
“com.comp.module.util” etc to an instance of IResource?
Currently, I am using this mechanism and it seems to be a
very inefficient one as I get a list of packages not just from source but from
all the packages available to the classloader
- Create IJavaProject from
project name.
- Get all packages from IJavaProject.getPackageFragments.
- Loop thru the array returned
above and break when done
- get an instance of IResource of
the package using IPackageFragment.getResource()
Can someone please help me with a easier way of achieving
the same. I can’t seem to find anything that will find the required IPackageFragment
with a single method call on IJavaProject. I IJavaProject.findPackageFragment
needs a IPath and IPath needs the absolute path from project root which is not available
to me. I cannot assume my package is available in project/src as I could have
more that one source folder configured in my build path.
Warm Regards
Ajaneesh