Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Inter-fragment-Dependencies
Inter-fragment-Dependencies [message #115955] Wed, 13 August 2008 12:00 Go to next message
Eclipse UserFriend
Originally posted by: Jens.Borrmann.gillardon.de

Hi,

given the following situation: A host bundle host, two fragments
fragment1
Fragment-Host: host
Export-Package: fragment1

fragment2
Fragment-Host: host
Import-Package: package1


Using eclipse I cannot find a way to have direct access to package1 from
within fragment2. Is there a possibility to write something in fragment2
like:

import package1;
SomeClassFromPackage1 x = new SomeClassFromPackage1();

assuming that fragment1 exports package1 and fragment2 imports package1.
I have tried all my eclipse tricks but still the IDE won't let me do
this...

What I figured out is that the following code snippet works in fragment2:

Object x =
this.getClass().getClassLoader().loadClass("package1.SomeClassFromPackage1 ").newInstance();


On the OSGi mailing list BJ Hargrave and Thomas Watson told me this was
not a general OSGi issue but a PDE issue. Unfortunately, I did not get
an answer on the pde-dev mailing list. Maybe here somebody can help me...

Best regards, Jens
Re: Inter-fragment-Dependencies [message #116104 is a reply to message #115955] Fri, 15 August 2008 11:53 Go to previous messageGo to next message
Danail Nachev is currently offline Danail NachevFriend
Messages: 110
Registered: July 2009
Senior Member
This is known limitation of PDE. The quick workaround is to add the
first fragment as a dependency for the second fragment. Import and
Export clauses are not required, because if they are fragment of the
same host, they will have the same classloader which gives you access to
all classes.

BR,
Danail

Jens Borrmann wrote:
> Hi,
>
> given the following situation: A host bundle host, two fragments
> fragment1
> Fragment-Host: host
> Export-Package: fragment1
>
> fragment2
> Fragment-Host: host
> Import-Package: package1
>
>
> Using eclipse I cannot find a way to have direct access to package1 from
> within fragment2. Is there a possibility to write something in fragment2
> like:
>
> import package1;
> SomeClassFromPackage1 x = new SomeClassFromPackage1();
>
> assuming that fragment1 exports package1 and fragment2 imports package1.
> I have tried all my eclipse tricks but still the IDE won't let me do
> this...
>
> What I figured out is that the following code snippet works in fragment2:
>
> Object x =
> this.getClass().getClassLoader().loadClass("package1.SomeClassFromPackage1 ").newInstance();
>
>
> On the OSGi mailing list BJ Hargrave and Thomas Watson told me this was
> not a general OSGi issue but a PDE issue. Unfortunately, I did not get
> an answer on the pde-dev mailing list. Maybe here somebody can help me...
>
> Best regards, Jens
Re: Inter-fragment-Dependencies [message #116315 is a reply to message #116104] Wed, 20 August 2008 06:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Jens.Borrmann.gillardon.de

Hi Danail,

thanks for your answer.

Your "quick workaround" works via adding the first fragment to the
"normal" build path (configure build path...) of the second one, doesn't
it? Or is there also a way to do this using the manifest file, which I
would like much more.

Are there any plans to remove this limitation of PDE?

-- Jens
Re: Inter-fragment-Dependencies [message #116320 is a reply to message #116315] Wed, 20 August 2008 06:47 Go to previous message
Danail Nachev is currently offline Danail NachevFriend
Messages: 110
Registered: July 2009
Senior Member
Yes, you need to setup it through the Java build path. There is no way
you can do it via PDE container.

I'm not aware of any plans to remove this limitation. You can search the
Eclipse bugzilla. There should be a bug against this limitation.

BR,
Danail

Jens Borrmann wrote:
> Hi Danail,
>
> thanks for your answer.
>
> Your "quick workaround" works via adding the first fragment to the
> "normal" build path (configure build path...) of the second one, doesn't
> it? Or is there also a way to do this using the manifest file, which I
> would like much more.
>
> Are there any plans to remove this limitation of PDE?
>
> -- Jens
Previous Topic:Re: Problem starting OSGI with framework.extension
Next Topic:Re: Help regarding equinox p2
Goto Forum:
  


Current Time: Fri Sep 20 23:24:09 GMT 2024

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

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

Back to the top