Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » attaching source to plugin in eclipse
attaching source to plugin in eclipse [message #605567] Tue, 13 April 2010 02:18 Go to next message
matt kerle is currently offline matt kerleFriend
Messages: 10
Registered: April 2010
Junior Member
Hi all

newcomer to PDE here so please be gentle.. ;-) I hope this is the right place to post this...

TL;DR how do you attach source to a plugin in a PDE project if it doesn't provide a source bundle?

I'm working on a project that uses OSGi/Equinox for it's dep. management, it's a geospatial middleware (I know...) so it uses a whole swag of 3rd party FOSS libraries. In trying to get my head around it I'm linking in all the source I can find, but I'm learning that in PDE it's not trivial...

Normally in eclipse to attach source I just open project properties, Java Build Path, select the library I want to browse, edit-> attach source, it's that easy.

but I'm learning that when your dependencies are plugins eclipse throws all that out the window and requires you know the intricacies of OSGi to be able to browse your source, if you're unlucky enough to want a library that isn't already exported as a plugin with source.

So, from googling it looks like the only way to browse the source of a plugin dependency is to build a plugin that is a source plugin for the target bundle, and add that to your target platform. eg:
http://rajakannappan.blogspot.com/2010/03/automating-eclipse -source-bundle.html

Am I missing something? can someone comment on why things have to be like this? why eclipse disables the existing attach-source functionality for plugins?

also, is there an easier way to attach source than having to rebuild the source as a plugin?

thanks for any insight!
Re: attaching source to plugin in eclipse [message #605569 is a reply to message #605567] Wed, 14 April 2010 01:23 Go to previous messageGo to next message
matt kerle is currently offline matt kerleFriend
Messages: 10
Registered: April 2010
Junior Member
from my own muddling about it looks like this is how you attach source to a plug-in dependency:

- download a source jar of the project
- crack it open and edit the MANIFEST.MF file
- add a line like this (geotools):
Eclipse-SourceBundle: org.opengis;version="2.2.0";roots:="."
it must match the target bundle *exactly*, "org.opengis" is the target Bundle-SymbolicName, and the version is the target Bundle-Version, not sure what roots does but it has to be there.

- you can add in the other bundle properties if you want, I think they're mostly optional, I did and it worked. the only other one you probably would want to add is the Bundle-SymbolicName, but make sure it's unique! otherwise you'll get a clash and things will break

then eclipse will magically see your source and ctrl-click and javadoc on hover will work correctly.

I still don't understand why this is this way, it's deeply counter-intuitive to the normal mode of use (although i guess it makes perfect sense to OSGi hackers...). I suppose there's a technical reason deep inside eclipse why this can't be the default mode with optional manual setting of source in addition...
Re: attaching source to plugin in eclipse [message #605583 is a reply to message #605569] Wed, 14 April 2010 22:15 Go to previous message
Ralf Ebert is currently offline Ralf EbertFriend
Messages: 168
Registered: July 2009
Senior Member
Hi Matt,

> I still don't understand why this is this way, it's deeply
> counter-intuitive to the normal mode of use (although i guess it makes
> perfect sense to OSGi hackers...).

I just wrote a PDE FAQ entry about this:
http://wiki.eclipse.org/PDE/FAQ#How_do_source_attachments_fo r_bundles_work

Greetings,

Ralf


--
Read my Blog here: http://www.ralfebert.de/blog/
Follow me on Twitter here: http://twitter.com/ralfebert/
Previous Topic:Text editor get/set text
Next Topic:Store settings
Goto Forum:
  


Current Time: Tue Mar 19 08:22:33 GMT 2024

Powered by FUDForum. Page generated in 0.02273 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top