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

4

10

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?

Agram answered 27/10, 2008 at 19:29 Comment(0)
E
13

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.

Elinaelinor answered 9/1, 2011 at 14:1 Comment(2)
This works BEAUTIFULLY! I still don't know how to make it "permanent", i.e. I can have source traceability/javadoc without having that (third party) plugin open as a project in my workspace (so I can attach javadoc/sources to the individual JARs that make up that plugin). But considering that it works...and I only need the javadoc for development only anyway... For now it suits my purposes just fine!Tradelast
If someone could show how to make a "proper" Eclipse source plugin / Eclipse javadoc plugin (is there one?)... I'd be very interested!Tradelast
L
3

If you use Eclipse SDK bundles when building your target platform, you should be immediately provided with "Java Source Attachment" and "Javadoc Location" for each Eclipse plugin. For example, I used "Eclipse Platform SDK" (eclipse-platform-SDK-3.4.2-win32) as target space and when I display the "Source Code Locations page" that you mentionned, it is filled with "Source locations declared in the target platform". In the Eclise IDE, I can then see Eclipse core plugins source code and javadoc (in JFace packages for example).

Otherway, it is not so easy to add plugins source code locations but you can succeed it in 2 ways :

  • providing a "source plugin" (the easiest way if the plugin provider also supplies the source plugin) into the target platform, as an ordinary plugin (PDE will recognise it)
  • providing an additional source location (not the easy way ...)

You can find more information about Target Source Code Locations in you Eclipse Help, in the following topic : Plug-in Development Environment Guide > Tools > Preferences > Target Platform Preferences > Source Code Locations

Logomachy answered 19/5, 2009 at 21:17 Comment(0)
L
1

All sources are available if you download the 'Eclipse for RCP and RAP Developers' build from the main downloads page. At least, that's what it's called for the Juno build, it used to be called Eclipse for RCP/Plug-in Developers.

It doesn't look like the plugin source code is available via the standard Java/J2ee Eclipse builds any longer. I was assuming the sources would be available via the update mechanism but have been unable to find the correct update site/feature. If anyone knows, please comment.

Lingle answered 21/9, 2012 at 17:13 Comment(0)
A
0

I can modify the target platform at runtime, using the -install runtime option. Keep the targetPlatform as the eclipse platform.

However, this loses a lot of the benefits of using a target platform in the first place - i.e. compile time safety.

Agram answered 27/10, 2008 at 19:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.