Why not create executable extensions
with the extension registry instead of search for the class files your
self. Also, if you at least know the class name then you can use
Bundle.loadClass to get the class object. There must be an easier
way to do this than looking for the class file yourself in the bundle.
Below is an answer to your question,
but I hope you don't have to do this :-)
You could read in the same properties
file that DevClassPathHelper does in the framework to determine the output
folders that are added to the classpath during PDE launch. The system
property "osgi.dev" is used to specify a URL to a properties
file that contains development classpath additions. See http://help.eclipse.org/help32/topic/org.eclipse.platform.doc.isv/reference/misc/runtime-options.html#osgidev
Note that inner jars on the bundle classpath
will give you some headaches when running a bundle that is not in your
workspace. You will have to extract the inner jar and use a ZipFile
your self to find the class file entries. You can use Bundle.getEntry
to get a URL to the inner jar but then you will have to use FileLocator.toFileURL
to extract the jar to the local file system or to locate the jar if it
is already on the local file system.
<computerslicer23@xxxxxxxxxxx> Sent by: equinox-dev-bounces@xxxxxxxxxxx
10/20/2006 06:49 PM
Please respond to
Equinox development mailing list <equinox-dev@xxxxxxxxxxx>
[equinox-dev] Finding Class Files
I'm writting a regression test application similar to "org.eclipse.test"
that uses extension points to register the test suites for a plug-in to
I currently use gsbase to walk directory trees and use reflection
construct the Class object for the file, and then look for anything that
implements the JUnit "Test" interface (it's more complex but
When the plug-ins are exported, I should be able to use the appropriate
"getClasspath()" and "getEntry" methods to find and
access the files
(special casing the "." and empty cases I believe).
I can use Bundle.findEntries(), while running inside the IDE, but
have to code or guess at the directory the code was output to. Unless
export ".project", or ".classpath", I don't appear
to have access to those
files. I was wondering if there was some way to be able to determine
output directories for a given Bundle when running from within the IDE.
I believe if I had access to the ClasspathManager I could get access
the ClassPathEntries, but I can't find a way to access the ClasspathManager
short of calling a protected or private function on various Bundle,
BundleData, or BundleLoader classes.
Try Search Survival Kits: Fix up your home and better handle your cash
equinox-dev mailing list