How do I attach source code locations to plugins in my Eclipse RCP target platform?

jamesh picture jamesh · Oct 27, 2008 · Viewed 9.3k times · Source

I've got a workspace with multiple RCP plugin projects.

We've set the target platform, so we can build against a standard set of plugins, but are not able to see source code and Javadoc for all the platform plugins.

The Windows -> Preferences -> Plug-in Development -> Target Platform -> Source Code Locations page doesn't seem to have any effect when I add the eclipse directory (it only allows you to add directories).

Copying the source jars from the eclipse directory into the target platform has a similar effect.

What am I doing wrong? How do I attach a set of Source jars to my target platform?

Answer

Christoph picture Christoph · Jan 9, 2011

I had the same problem today. In my case I wanted to debug into the source of the plugin embedded jetty (org.mortbay.jetty_5.1.14.v200806031611.jar) which comes with Eclipse Equinox (OSGI) which is part of my eclipse target platform.

When debugged and wanted to go into any class inside a jetty package I always got the message that it is a class from Plugin-Dependencies and the source attachment cannot be modified.

I solved it like this:

  1. Switch to the Plugins View in Eclipse ( Window / Show View / Plugins)
  2. locate the bundle org.mortbay.jetty
  3. right click on that bundle and select "Import as" -> "Binary Project with linked content"

Now that Bundle shows up in your Package Explorer as a new Eclipse project, in my case org.mortbay.jetty.

Now right click on that new project in the package explorer and goto 'Properties / Java Build Path / Libraries'. You see the the jetty jar file there and if you expand this entry you can edit the 'Source Attachment' as usual. I pointed it to the downloaded Jetty Source code located in a completely different folder than my target platform which I am using for my project.