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(how to attach source to an existing plugin?)
attaching source to plugin in eclipse [message #526804] 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 #527088 is a reply to message #526804] 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 #527350 is a reply to message #527088] Wed, 14 April 2010 22:15 Go to previous messageGo to next 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/
Re: attaching source to plugin in eclipse [message #527358 is a reply to message #527350] Thu, 15 April 2010 01:07 Go to previous messageGo to next message
matt kerle is currently offline matt kerleFriend
Messages: 10
Registered: April 2010
Junior Member
thanks Ralf! Good to have that info out there for newbies to PDE like me!

I still think that it would make sense from a usability point-of-view to let users attach source if none is detected from classpath, since if there's no source on classpath then there's nothing to overwrite, but if there is then it will just "do the right thing", and as the user becomes more proficient they can configure their classpath correctly .

Obviously there was a discussion about this issue when it was implemented and the decision to disallow user-adding of source was made for a good reason...

cheers!
Re: attaching source to plugin in eclipse [message #527359 is a reply to message #527358] Thu, 15 April 2010 02:11 Go to previous messageGo to next message
matt kerle is currently offline matt kerleFriend
Messages: 10
Registered: April 2010
Junior Member
another n00b point, when you add the source jar with the new manifest you need to restart eclipse for it to see the change, at least with my 20090920-1017 web developer build..). reloading target platform doesn't seem to be enough by itself.

"Have you tried turning it off, and turning it back on again?" Wink
Re: attaching source to plugin in eclipse [message #527390 is a reply to message #527359] Thu, 15 April 2010 06:28 Go to previous messageGo to next message
Ralf Ebert is currently offline Ralf EbertFriend
Messages: 168
Registered: July 2009
Senior Member
Hi Matt,

> another n00b point, when you add the source jar with the new manifest
> you need to restart eclipse for it to see the change, at least with my
> 20090920-1017 web developer build..). reloading target platform doesn't
> seem to be enough by itself.

if that's reproducable with a standard bundle, that's a bug that should go to
bugs.eclipse.org. I searched for existing bugs without result:

https://bugs.eclipse.org/bugs/buglist.cgi?query_format=advan ced ;short_desc=target%20source;bug_status=UNCONFIRMED;bug_statu s=NEW;bug_status=ASSIGNED;bug_status=REOPENED;short_desc_typ e=allwordssubstr;classification=Eclipse;product=PDE

Greetings,

Ralf



--
Learn how to contribute to Eclipse here: http://eclipse.org/contribute/
Read my Blog here: http://www.ralfebert.de/blog/
Follow me on Twitter here: http://twitter.com/ralfebert/
Re: attaching source to plugin in eclipse [message #527658 is a reply to message #527390] Fri, 16 April 2010 00:41 Go to previous messageGo to next message
matt kerle is currently offline matt kerleFriend
Messages: 10
Registered: April 2010
Junior Member
no, I'm not using standard bundles that's the problem.. Wink

and probably why not many other people have this issue, I'm working with an SDK on a spatial integration middleware that uses OSGi for it's dependency management, so most of my dependencies don't come with source, I have to go and track them down myself... I downloaded the eclipse SDK and the source there links perfectly Smile

thanks for the pointer though!
Re: attaching source to plugin in eclipse [message #605585 is a reply to message #527350] Thu, 15 April 2010 01:07 Go to previous messageGo to next message
matt kerle is currently offline matt kerleFriend
Messages: 10
Registered: April 2010
Junior Member
thanks Ralf! Good to have that info out there for newbies to PDE like me!

I still think that it would make sense from a usability point-of-view to let users attach source if none is detected from classpath, since if there's no source on classpath then there's nothing to overwrite, but if there is then it will just "do the right thing", and as the user becomes more proficient they can configure their classpath correctly .

Obviously there was a discussion about this issue when it was implemented and the decision to disallow user-adding of source was made for a good reason...

cheers!
Re: attaching source to plugin in eclipse [message #605586 is a reply to message #605585] Thu, 15 April 2010 02:11 Go to previous messageGo to next message
matt kerle is currently offline matt kerleFriend
Messages: 10
Registered: April 2010
Junior Member
another n00b point, when you add the source jar with the new manifest you need to restart eclipse for it to see the change, at least with my 20090920-1017 web developer build..). reloading target platform doesn't seem to be enough by itself.

"Have you tried turning it off, and turning it back on again?" ;)
Re: attaching source to plugin in eclipse [message #605588 is a reply to message #605586] Thu, 15 April 2010 06:28 Go to previous messageGo to next message
Ralf Ebert is currently offline Ralf EbertFriend
Messages: 168
Registered: July 2009
Senior Member
Hi Matt,

> another n00b point, when you add the source jar with the new manifest
> you need to restart eclipse for it to see the change, at least with my
> 20090920-1017 web developer build..). reloading target platform doesn't
> seem to be enough by itself.

if that's reproducable with a standard bundle, that's a bug that should go to
bugs.eclipse.org. I searched for existing bugs without result:

https://bugs.eclipse.org/bugs/buglist.cgi?query_format=advan ced ;short_desc=target%20source;bug_status=UNCONFIRMED;bug_statu s=NEW;bug_status=ASSIGNED;bug_status=REOPENED;short_desc_typ e=allwordssubstr;classification=Eclipse;product=PDE

Greetings,

Ralf



--
Learn how to contribute to Eclipse here: http://eclipse.org/contribute/
Read my Blog here: http://www.ralfebert.de/blog/
Follow me on Twitter here: http://twitter.com/ralfebert/
Re: attaching source to plugin in eclipse [message #605598 is a reply to message #527390] Fri, 16 April 2010 00:41 Go to previous message
matt kerle is currently offline matt kerleFriend
Messages: 10
Registered: April 2010
Junior Member
no, I'm not using standard bundles that's the problem.. ;)

and probably why not many other people have this issue, I'm working with an SDK on a spatial integration middleware that uses OSGi for it's dependency management, so most of my dependencies don't come with source, I have to go and track them down myself... I downloaded the eclipse SDK and the source there links perfectly :)

thanks for the pointer though!
Previous Topic:MultiPageEditorPart
Next Topic:PDE/API Tools : Exclude List with Regular Expressions
Goto Forum:
  


Current Time: Tue Mar 19 02:52:14 GMT 2024

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

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

Back to the top