Search code examples
javaeclipseeclipse-plugineclipse-pde

Include all workspace classes in eclipse plugin


I'm trying to transport arbitrary Java objects from workspace to my plugin by serializing them to XML using XStream. This works fine (using SIMON), but when trying to restore them on plugin-site, I get a CannotResolveClassException (obviously). So I'd like to somehow include workspace classes in my plugin's build path, in order to make workspace types available inside my plugin and therefore be able to restore objects.


Solution

  • I've managed to do this by using a URLClassLoader and going throug all projects in workspace (using the Resources Plugin) and adding all subfolders (recursively) to this classLoader. I know it's some kind of brute-force, but it's working and I couldn't figure out how to determine the build target folder (not always /bin).